12월, 2018의 게시물 표시

shuffled

func shuffleTest() {   var items = ["A", "B", "C", "D", "E", "F", "G", "H"]   let copyItems = items   var shuffled = [String]()   for i in 0..<items.count {     let rand = Int(arc4random_uniform(UInt32(items.count)))         shuffled.append(items[rand])         items.remove(at: rand)   }   print(shuffled)     print( copyItems.shuffled() ) } ["H", "B", "G", "C", "F", "E", "D", "A"] ["E", "B", "G", "H", "C", "A", "F", "D"] https://developer.apple.com/documentation/swift/array/2994757-shuffled

Swinject

이미지
https://github.com/Swinject/Swinject https://www.raywenderlich.com/17-swinject-tutorial-for-ios-getting-started 의존성 주입 이란  외부에서 의존 객체를 생성하여 넘겨주는 것 을 의미합니다. 예를들어 A Class가 B Class를 의존할 때 B Object를 A가 직접 생성하지 않고 외부에서 생성하여 넘겨주면 의존성을 주입했다고 합니다. 출처:  http://faith-developer.tistory.com/147 Swinject SwinjectStoryboard The following blog posts demonstrate step-by-step development of the project. Dependency Injection in MVVM Architecture with ReactiveCocoa Part 1: Introduction Dependency Injection in MVVM Architecture with ReactiveCocoa Part 2: Project Setup Dependency Injection in MVVM Architecture with ReactiveCocoa Part 3: Designing the Model Dependency Injection in MVVM Architecture with ReactiveCocoa Part 4: Implementing the View and ViewModel Dependency Injection in MVVM Architecture with ReactiveCocoa Part 5: Asynchronous Image Load "Dependency Injection" is a 25-dollar term for a 5-cent concept. -  James Shore Dependency injection means...

ARC (Automatic Reference Counting)

이미지
https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html class Person { let name : String init ( name : String ) { self . name = name } var apartment : Apartment ? deinit { print ( " \ ( name ) is being deinitialized" ) } } class Apartment { let unit : String init ( unit : String ) { self . unit = unit } var tenant : Person ? deinit { print ( "Apartment \ ( unit ) is being deinitialized" ) } } Weak References     Property observers aren’t called when ARC sets a weak reference to.  nil . class Person { let name : String init ( name : String ) { self . name = name } var apartment : Apartment ? deinit { print ( " \ ( name ) is being deinitialized" ) } } class Apartment { let unit : String init ( unit : String ) { self . unit = unit } weak var tenant : Person ? deinit { print ( "Ap...

지금 이 순간

바라는 것은 오직 단 하나, 지금 이 순간입니다. 오직 그 속에서만, 우리는 바야흐로 만남도 헤어짐도 없는 영원을 살게 될 테니까요. <당신이라서 가능한 날들이였다_정기린>

여행

test2

Better Lives

test