본문 바로가기

전체 글530

[iOS] iOS에서의 Multi-Layer Architecture 출처: https://medium.com/2-minutes-read-tip/how-to-organize-your-ios-project-like-a-pro-and-maximize-your-productivity-5d580b7dc4a3 iOS Project Structure Like a Pro Improved code organization, separation of concerns, reusability, testing medium.com Multi-layer architecture는 application을 분리된 layer들로 나누는 것으로, 각각의 layer는 저마다 특정한 목적을 가진다. 이 architecture의 가장 중요한 목적은 code 구조, concern의 분리, 재사용성, 협업 능력, 테.. 2023. 1. 23.
[iOS] iOS에서의 대표적인 Design Pattern들 https://howtoinswift.tech/blog/iOS/All-iOS-Design-patterns-you-should-know All iOS Design patterns you should know Design patterns are definitely something you must consider learning one day howtoinswift.tech 1. MVC (Model - View - Controller) MVC는 UI에서 data의 표현을 분리하는 software architecture 패턴이다. iOS에서 MVC는 code를 구성하고 concern들을 분리해내는데 쓰인다. 제일 대표적인 예시가 UIViewController이며 MVC에서 Controller에 해당한다. 2... 2023. 1. 21.
[iOS] nibName에 따른 ViewController 초기화 https://developer.apple.com/documentation/uikit/uiviewcontroller/1621359-init Apple Developer Documentation developer.apple.com https://developer.apple.com/documentation/uikit/uiviewcontroller/1621487-nibname Apple Developer Documentation developer.apple.com init(nibName:bundle:) 지정된 bundle에서 nibName을 통해 nib파일을 찾아 새로운 UIViewController 인스턴스를 만들어내는 함수 Discussion UIViewController의 designated initia.. 2023. 1. 21.
[Swift] lazy var 사용 시 retain cycle 주의 [iOS - swift] lazy var 클로저 사용 주의 (리테인 사이클, 메모리 릭) Lazy var 클로저 사용시 주의사항 lazy var 클로저 사용 시 retain cycle이 발생하는지? 아래 1)번과 2)번 구분 (아래에서 계속) 1) private let text = "label" private lazy var label: () -> UILabel = { let label = UILabel() label. ios-development.tistory.com lazy var는 어떠한 연산을 통해 변수를 생성하기 위해서 closure를 사용하게 된다. 이 때 아래와 같이 블록{} 마지막에 () 가 붙은 형태는 nonescaping closure라고 해서 실행 즉시 결과를 반환함을 가정하기 때문에.. 2023. 1. 16.