Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
Tags
- 스위프트
- SWIFTUI
- 독후감
- SWIFT
- mvvm
- @available
- 야곰아카데미
- 아이폰
- viewcontroller
- NumberFormatter
- NotificationCenter
- Info.plist
- 부트캠프
- human interface guidelines
- Failed to register bundle identifier
- roundingMode
- delegation
- Mock
- Navigation
- UIResponder
- 독서후기
- 책후기
- IOS
- 스타트업주니어로살아남기
- contentInset
- Codegen
- Structures and Classes
- View Life Cycle
- xcode
- Modality
Archives
- Today
- Total
목록NumberFormatter (1)
호댕의 iOS 개발
[Swift] NumberFormatter roundingMode
NumberFormatter를 보면 지정한 소수점에 맞춰 어떻게 올림, 버림, 반올림을 할 지 정할 수 있는 인스턴스 프로퍼티가 존재한다. 제목에도 나와있듯 roundingMode가 바로 그것이다. 여기서는 7가지 종류로 어떻게 소수점을 처리할 지 정할 수 있다. .up .down .ceiling .floor .halfUp .halfDown .halfEven 그렇다면 각각 어떤 식으로 소수점을 처리하는 것일까? .up Round away from zero. 0으로 부터 멀어지도록 소수점을 처리하게 된다. 즉 음수일 때는 작아지는 방향으로, 양수일 때는 커지는 방향으로 소수점을 처리한다. 만약 let numberFormatter = NumberFormatter() numberFormatter.maximum..
Software Engineering/Swift
2021. 11. 21. 21:33