일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- collectionview
- SWIFT
- swiftUI
- MVVM
- RxCocoa
- 리펙토링
- ios
- Protocol
- ribs
- 리팩토링
- Xcode
- HIG
- 애니메이션
- map
- Human interface guide
- tableView
- clean architecture
- Observable
- rxswift
- Refactoring
- 스위프트
- uitableview
- UITextView
- 리펙터링
- 클린 코드
- swift documentation
- UICollectionView
- uiscrollview
- combine
- Clean Code
- Today
- Total
목록SET (5)
김종권의 iOS 앱 개발 알아가기
OptionSet 개념 enum-case의 case와 같이 사용할 수 있고 동시에 set 연산자인 insert, remove 등도 사용할 수 있는 API OptionSet 프로토콜 형태 SetAlgebra는 set의 연산자를 정의해놓은 프로토콜 public protocol OptionSet : RawRepresentable, SetAlgebra { associatedtype Element = Self init(rawValue: Self.RawValue) } SetAlgebra 형태 /// - `S() == []` /// - `x.intersection(x) == x` /// - `x.intersection([]) == []` /// - `x.union(x) == x` /// - `x.union([]) =..
allSatisfy 연산자 Collection의 모든 요소가 특정 조건을 만족시키는지 알고 싶은 경우 사용 ex) 배열을 순회하면서 원소들이 특정 조건을 모두 만족하는지 확인할 때 사용 Array, Dictionary, Set 타입에 사용 let arr = ["abcdef", "12345", "문자열"] let bool = arr.allSatisfy { $0.count > 2 } print(bool) // true let dict = ["1": 1, "2": 2] let bool2 = dict.allSatisfy { $0.key == String($0.value) } print(bool2) // true var set = Set() set.insert(2) set.insert(4) set.insert(6..
Swift 컬렉션은 3가지 Array Set Dictionary Array 갯수와 값을 지정한 초기화 let intArr = [Int](repeating: 0, count: 10) 추가: '+=' 연산자 사용 intArr += [2] 삽입: insert(_:at:) 기존에 at에 있던 값은 오른쪽으로 밀려나는 형태 var intArr = [Int](repeating: 0, count: 3) // [0, 0, 0] intArr.insert(2, at: 1) // [0, 2, 0, 0] 삭제: remove(at:) var intArr = [Int](repeating: 0, count: 3) // [0, 0, 0] intArr.insert(2, at: 1) // [0, 2, 0, 0] let removedVa..
Stored Property vs Computed Property Stored Property는 초기화 값이 존재하는 프로퍼티 Computed Property는 최가화 값이 존재하지 않는 프로퍼티 - 예시) p1은 초기화 값이 존재하므로 Stored Property p2는 초기화 값이 존재하지 않으므로 Computed Property p3는 바로 초기화값이 존재하지 않지만 init구문에서 p3를 초기화해주므로 Stored Property class PropertyTest { // 1 var p1: Int = 1 // 2 var p2: Int { get { return p1 + 2 } set { print(newValue) } } // 3 var p3: Int { didSet { print(p3) } } ..
알고리즘 핵심: https://ios-development.tistory.com/525 swift로 알고리즘 접근 코드의 간결화를 위해 강제 unwraping 사용 string타입에서 특정 character접근 시 [Charactor] or [String] 타입으로 변환하여 효율적으로 접근 String타입에서 특정 character 접근 시 O(N) Array타입은 random access O(1) String의 for문에서 value값은 String.Element형 :(for문 안에서 Int형으로 변경하고 싶은 경우, String으로 먼저 변형) swift는 Array, Set, Dictionary 세 가지 collection을 제공하므로 나머지 세 가지에 대해 어떻게 쓸것인지 미리 고민 Heap: S..