목록앱 개발/iOS (51)
나의 발자취
UIColor ColorLiteral UIKit에서, Color. 대신 컬러칩으로 하고싶으면 ColorLiteral을 하면 뜬다. Optional Chaining 1) Force Unwrapping (optional!) 2) Check the nil value if optional != nil { optional! } 3) Optional binding (If-let) if let safeOptional = optional { safeOptional } 4) Nil Coalescing ( Optional ?? DefaultValue) 5) Optional Chaining ( optional?.property / optional?.method() )
그림에서부터 설명이 잘되어있다. https://velog.io/@minji0801/iOS-Application-Life-Cycle-iOS-%EC%95%B1%EC%9D%98-%EC%83%9D%EB%AA%85%EC%A3%BC%EA%B8%B0
아이폰 내에서의 파일시스템이 어떻게 이루어져있는지 정~말 기본적이지만 그동안 솔직히 iOS 공부를 못해서 까먹은 겸 다시 복기하는 차원에서 읽어본 글이다. https://medium.com/@lucideus/understanding-the-ios-file-system-eee3dc87e455
A class is another means of modeling real-life objects programmatically. 클래스는 실제 생활에 적용되는 객체들을 프로그래밍적 관점으로 모델링하는 것을 뜻하기도 한다 How to create a class using the class keyword. Using the init() method allows us to provide an instance with specific values right off-the-bat during the creation of an instance. 클래스의 init() 메서드는 인스턴스를 만들 때 바로 특정 밸류값을 가질 수 있도록 하는 기능이다. A class can inherit another class’s pr..
Levels of Access Public We’ll start with public, the most open level, which grants access to a property or method from inside or outside the module. Relating it to the company analogy, since modules are companies, public information can be shared between companies. This level is typically used when creating frameworks so that modules that import the framework can access its properties and method..
* argument label 을 _ 로 하면 function invoke 시 argument label을 쓰지 않아도 된다 * multiple values는 튜플로 반환한다. func favoriteCuisine() -> (name:String, dish:String) { return ("Russian", "Pelmeni") } let cuisine = favoriteCuisine() print("My favorite \(cuisine.name) dish is \(cuisine.dish)!")* Implicit return 이란, swift 5.1(20년 2월)부터 생긴 것으로 return이 한줄이면 return 키워드를 생략해도 된다. * default parameter는 argument 뒤에 = 하..
either value or nil 을 가질 수 있는 optional을 언랩핑할때 사용하는 방법 중 하나이다. 옵셔널을 처리하기 위해 스위프트에서는 옵셔널 바인딩 이라는것을 하는데, 옵셔널 바인딩이란 옵셔널을 언랩핑하여 그 값에 접근할 수 있도록 하는것이다. 여기서 if-let은 conditional unwrapping 이다. 이런 식으로 쓰인다. if let newVariable = dictionaryName[optionalValue] { // This code will run if the optional contains a real value }
var easyAsPie = ("easy as", 3.14) Above, we created easyAsPie that holds 2 values: "easy as", and 3.14. If we wanted to access each value individually, we can use dot syntax along with the index of the value: var easyAsPie = ("easy as", 3.14) var firstValue = easyAsPie.0 // "easy as" var secondValue = easyAsPie.1 // 3.14 We can also name a tuple’s elements by prepending each one with a name and ..