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 |
Tags
- Failed to register bundle identifier
- IOS
- human interface guidelines
- delegation
- 독서후기
- mvvm
- NotificationCenter
- xcode
- 부트캠프
- NumberFormatter
- Mock
- 스위프트
- Codegen
- 야곰아카데미
- viewcontroller
- 아이폰
- contentInset
- 책후기
- Modality
- 스타트업주니어로살아남기
- @available
- Structures and Classes
- SWIFT
- UIResponder
- View Life Cycle
- Info.plist
- 독후감
- SWIFTUI
- roundingMode
- Navigation
Archives
- Today
- Total
목록NumberFormatter (1)
호댕의 iOS 개발

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