fetchRequest.sortDescriptors = [NSSortDescriptor(key: “id”, ascending: true, selector: “localizedStandardCompare:” )]

tap gesture recognizer에서 translation에 대한 정의 (이동한 거리를 나타낸다)     https://youtu.be/0fXR-Ksuqo4?t=14m

panning 작업이 끝나는 경우 처리    https://youtu.be/0fXR-Ksuqo4?t=17m50s

기존의 UIView에 기능을 추가 해서 사용하는 방법으로는 subclass를 만들어 사용하는 것과 expension을 이용 확대하는 방법이 있다.

단 expension의 경우 stored property를 새로 추가 할수 는 없다. (참조 https://docs.swift.org/swift-book/LanguageGuide/Extensions.html    Extensions can add new computed properties, but they cannot add stored properties, or add property observers to existing properties.)



하부 subclass에서 상부의 init()을 이용하는 경우 사용하기 전에 먼저 subclass에서 추가된 property의 값이 할당이 되어야 수행된다. 

Swift has a very clear, specific sequence of operations that are done in initializers. Let’s start with some basic examples and work our way up to a general case.

Let’s take an object A. We’ll define it as follows.

class A {
    var x: Int
    init(x: Int) {
        self.x = x
    }
}

Notice that A does not have a superclass, so it cannot call a super.init() function as it does not exist.

OK, so now let’s subclass A with a new class named B.

class B: A {
    var y: Int
    init(x: Int, y: Int) {
        self.y = y
        super.init(x: x)
    }
}

This is a departure from Objective-C where [super init] would typically be called first before anything else. Not so in Swift. You are responsible for ensuring that your instance variables are in a consistent state before you do anything else, including calling methods (which includes your superclass’ initializer).

subclass 를 이용 추가 property를 사용하는 예시들

class ViewController: UIViewController {

    var imageURL: NSURL?

    // this is a convenient way to create this view controller without a imageURL
    convenience init() {
        self.init(imageURL: nil)
    }

    init(imageURL: NSURL?) {
        self.imageURL = imageURL
        super.init(nibName: nil, bundle: nil)
    }

    // if this view controller is loaded from a storyboard, imageURL will be nil

    /* Xcode 6
    required init(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    */

    // Xcode 7 & 8
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
}

class UIGridCell:UIView {

   var id:String=“”

   override init(frame: CGRect) {

       super.init(frame: frame) // calls designated initializer

   }

   convenience init(id: String) {

       self.init(frame: CGRect.zero)

       self.id = id

   }

   required init?(coder aDecoder: NSCoder) {

       super.init(coder: aDecoder)

   }

}

scrollview 내부에 auto layout 이 사용된경우

( storyboard를 이용하거나 programmatically 하거나 )에는 scrollview에도 auto layout을 적용해야 한다. 그렇지 않으면 black screen만 나오는 경우가 생긴다.

https://stackoverflow.com/a/42743971/3151712

https://stackoverflow.com/a/42743371/3151712

What’s new in Core Data Swift 3.0 https://blog.jayway.com/2016/08/12/whats-new-core-data-swift-3-0/

Beginner Guide to Core Data in Swift

https://www.bobthedeveloper.io/blog/beginner-guide-to-core-data-in-swift

Getting Started with Core Data Tutorial

https://www.raywenderlich.com/173972/getting-started-with-core-data-tutorial-2

CSV reading and writing library written in Swift. (3rd party library docs)

https://github.com/yaslab/CSV.swift#usage-for-reading-csv