- 제목
- 소개
- 팀원
- 타임라인
- 프로젝트 구조
- 실행화면
- 트러블 슈팅
- 참고 링크
- 사용자가 숫자패드와 기호를 통해 입력한 값의 연산 결과를 출력하는 앱입니다.
- Step 1
- CalculatorQueue 병합
- ExpressionParser 병합
- FormulaStackView 병합
Details
-
2022.10.04
- CalculatorQueue 병합
- ExpressionParser 병합
- FormulaStackView 병합
Details
-
2022.10.06
-
2022.10.07
- 숫자 입력 기능 Refactoring
- 연산자 입력 기능 Refactoring
- 부호 입력 기능 Refactoring
- 소수점 입력 기능 Refactoring
- 전반적인 네이밍 및 컨벤션 수정
정상적인 계산 |
연산자 변경 |
![](https://camo.githubusercontent.com/b59f64891d634a27d27481edfb04be77a915432a7d43a7222702353189b90e76/68747470733a2f2f692e696d6775722e636f6d2f4d4c6a447875722e676966) |
![](https://camo.githubusercontent.com/d93e2853bec74bb470dac854577271deb339d33cfae4d2d644a3854818a3f5c4/68747470733a2f2f692e696d6775722e636f6d2f526a595a5465612e676966) |
0으로 나누기 |
소수 계산 |
![](https://camo.githubusercontent.com/ab782f417bb6ada3ba0e0ffad6bb22277676cb49815c3d4b4d03c4b267d4e60d/68747470733a2f2f692e696d6775722e636f6d2f525076754956682e676966) |
![](https://camo.githubusercontent.com/4e359dad8f9013af59f6fcf9974cece8f6378f47cf99c472b24d370d2e1a1994/68747470733a2f2f692e696d6775722e636f6d2f314131664c706c2e676966) |
- 숫자를 저장하는
numberString
프로퍼티에 0이 계속해서 쌓이는 버그가 발생했습니다.
propertyWrapper
를 이용해서 0과 00을 클릭할 시 현재 저장되어 있던 숫자가 0이면 숫자의 입력 결과는 0이 되도록 구현하여서 해결했습니다.
Before |
After |
![](https://camo.githubusercontent.com/e32c362e677365f61a7f2e71bb48a82e23483c6b98d9490821d599aefa7e77f4/68747470733a2f2f692e696d6775722e636f6d2f345a5a714f5a782e676966) |
![](https://camo.githubusercontent.com/de3b04ba45d79cc768622a4d995d75ccbbaed4162d5eb24085d67e3d471e0eaf/68747470733a2f2f692e696d6775722e636f6d2f42696c415241712e676966) |
- 0의 중복을 체크하는 로직에 의해 소수점을 입력하면 숫자가 저장되는 변수가 '.'가 되어 0이 없어지는 버그가 발생했습니다.
- 0의 중복을 체크하는 로직을 수정하여 숫자가 저장되는 변수에 소수점이 정상적으로 입력되게 수정했습니다.
Before |
After |
![](https://camo.githubusercontent.com/20b8b5dde09ad9c7974a45ae50de2eacdb8299c5fcb40a5563a56857fe667e14/68747470733a2f2f692e696d6775722e636f6d2f7a79456e3672442e676966) |
![](https://camo.githubusercontent.com/5d5aa103923b0093ee0998a41dc646d9fdfb3f46170e63d9f9bf90cc7b3ed517/68747470733a2f2f692e696d6775722e636f6d2f566a654e6f51772e676966) |
last
키워드를 사용하여 마지막 값이 소수점이 아니면 소수점을 입력하는 로직을 사용하여서 계속해서 소수점을 입력할 수 있는 버그가 발생했습니다.
contains()
메소드를 이용하여 소수점이 없는경우에만 소수점을 입력하게 수정하여서 해당 버그를 해결했습니다.
Before |
After |
![](https://camo.githubusercontent.com/6ccc2d903465d298a3ef176aa26a50815c5fe5254f8cc4494c3902e62f26e02a/68747470733a2f2f692e696d6775722e636f6d2f36424a637459542e676966) |
![](https://camo.githubusercontent.com/33553f6d68bc34d28429ffc9bb328d7de989fb5bc2c768c9f566abb374e43a90/68747470733a2f2f692e696d6775722e636f6d2f6f4a4b5a426a762e676966) |
- 초기화면에서 연산자가 변경이 가능하여 숫자를 입력한 후 연산자를 입력하면 초기화면에서 변경된 연산자가 StackView에 같이 등록되는 버그가 발생했습니다.
- 초기화면이라는 상태를 알려주는 변수 및 현재 상태가 초기화면인지 확인하는 로직을 추가해서 연산자를 변경하지 못하게 방어했으며 이를 통해 해당 버그를 해결했습니다.
Before |
After |
![](https://camo.githubusercontent.com/d7b7a53f09bef12c5aeef9ffeec91624a30ddfbb57af59b1fb8fe84c2333ed99/68747470733a2f2f692e696d6775722e636f6d2f5861513069414a2e676966) |
![](https://camo.githubusercontent.com/7b6d08895531496b43c2943ac9674e8a2688536cd0cab0e76c7469659e9d6b62/68747470733a2f2f692e696d6775722e636f6d2f364d6a587a42752e676966) |
계산 결과에 소수점 아래 쓸모없는 값이 출력되는 버그
- 계산결과인 Double형태를 직접 숫자를 저장하는 프로퍼티에 String형태로 변환하여 할당해줬습니다. 이로 인해 소수점 아래 쓸모없는 값이 출력되는 버그가 발생했습니다.
- 계산 결과를 NumberFormatter로 변환한 후 변환된 값을 숫자를 저장하는 로직을 통해서 해당 문제를 해결했습니다.
Before |
After |
![](https://camo.githubusercontent.com/29413be536ef2ab9fb135382306e35b804dd45db4b7f0ff0d305fb8e87eeb473/68747470733a2f2f692e696d6775722e636f6d2f767551376b46502e676966) |
![](https://camo.githubusercontent.com/21cd2e600a7f6eb33ff8a512ce6493b2499f90c30c76b73cf776e3efaa1da379/68747470733a2f2f692e696d6775722e636f6d2f727644536338692e676966) |
https://developer.apple.com/documentation/swift/caseiterable
https://ko.wikipedia.org/wiki/%ED%85%8C%EC%8A%A4%ED%8A%B8_%EC%A3%BC%EB%8F%84_%EA%B0%9C%EB%B0%9C
https://en.wikipedia.org/wiki/Queue
https://ko.wikipedia.org/wiki/%EC%97%B0%EA%B2%B0_%EB%A6%AC%EC%8A%A4%ED%8A%B8
https://en.wikipedia.org/wiki/Doubly_linked_list
https://developer.apple.com/documentation/uikit/uibutton
https://developer.apple.com/documentation/uikit/uilabel
https://developer.apple.com/documentation/uikit/uistackview
https://developer.apple.com/documentation/uikit/uiscrollview
https://developer.apple.com/documentation/foundation/numberformatter