Giter Club home page Giter Club logo

ios-calculator-app's Introduction

계산기


목차


팀원

Kiseok Hisop
GitHub GitHub

타임라인

날짜 내용
23.10.16 - Merge계획 수립 및 개인 코드 정리
23.10.17 - 계산기 코드 병합 및 PR
23.10.18 - 피드백 요구 사항 반영
23.10.19 - 계산기 코드 리팩터링 및 PR
23.10.20 - README 작성

시각화 구조

Class Diagram

632a7061324ce85b6f34ebd5

실행 화면

트러블 슈팅

Queue의 자료구조 선택

  • 더블스택 채택
    • 시간복잡도 면에서 LinkedList와 차이가 없으며, 배열 구조로 유닛 테스트환경에서 임의의 값을 넣어주기 편하고, 구조가 단순하여 이해해기 좋다는 장점이 있어 채택하게 됨

연산 결과 부동소수점 오류

  • 소수점 연산 시 부동 소수점 오류 때문에 제대로된 연산값이 나오지 않는 경우가 발생함
    연산 결과값에 numberFormatter를 사용하여 해결함
func numberFormatter() -> String {
       let numberFormatter = NumberFormatter()
       numberFormatter.numberStyle = .decimal
       numberFormatter.maximumFractionDigits = 20
       
       return numberFormatter.string(for: Double(self)) ?? ""
   }
// 9x1.2 연산을 했을 때 10.79999999...가 나오던 오류를 10.8로 고쳐줌

ScrollView 화면 자동으로 하단 이동 구현

  • 스크롤뷰에 스택 추가 할 때마다 스크롤뷰 밑으로 이동 구현 스택뷰를 추가할 때마다 offset값을 이용하여 맨 밑으로 이동하는 로직을 구현하였으나 바닥까지 내려가지 않음
    -> offset값을 구하는 순간에 추가된 스택뷰를 포함하여 계산되지 않아 생긴 문제
    -> layoutIfNeeded 메서드를 사용하여 뷰 드로잉 사이클을 기다리지 않고 즉시 실행되도록 변경함
private func scrollToBottom() {
        formulaScrollView.layoutIfNeeded()
        formulaScrollView.setContentOffset(CGPoint(x: 0, y: formulaScrollView.contentSize.height - formulaScrollView.bounds.height), animated: false)
    }

참고 링크

Apple 공식문서 - Array
Apple 공식문서 - reversed
Apple 공식문서 - UIStackView
Apple 공식문서 - Auto Layout
Apple 공식문서 - XCTest
Apple 공식문서 - NumberFormatter
Apple 공식문서 - Split
Apple 공식문서 - removeArrangedSubview
Apple 공식문서 - UILabel
Apple 공식문서 - IntrinsicContentSize


ios-calculator-app's People

Contributors

carti1108 avatar yagom avatar hi-sop avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.