This article is for recording the resources which I collected together about how to gracefully use swift, an language released by Apple in 2014. Hopefully this post will help you.
As with other people who are newcomers to swift, I will start with reading source code by authors who are exprienced. The following projects are with my comments to explain what it is doing.
- Recordings: It is for Swift 5 and iOS 13 and contains serveral examples under different app architectures, you may visit Github to see more details. Credits: ObjC China
Serialization: Encoding & Decoding
Although Apple Development Documentation is a great reference, it is not for the newbies. You may refer to this PDF if you want to learn what is it and how it works.
Automatic Reference Counting (ARC)
For beginner, it is a tricky thing to deal with reference counting, although it's easier compared to the situation without ARC. As a result, it causes Strong Reference Cycles if mishandled. There are some posts to describe what is ARC and whether you need
[weak self] or
[unowned self] in a closure entirely and detailedly:
UIStackView is a useful component for iOS/macOS developor, and it makes your app more flexible, here are some tutorials for those who are not familiar with:
- Basic knowledge: UIStackView Tutorial for iOS: Introducing Stack Views
- How to fix left-hand elements and stretch the last elements to fill the width: Stretch the last element in UIStackView
App's Life Cycle (for iOS13)
Getter & Setter
private(set)is a way to set a public getting and private setting, but you could build public setter for yourself as well: Swift Magic: Public Getter, Private Setter
Error of embeded framework in Xcode 11
Multiple commands produce 'xxx.framework': 1) Target 'xxx' has copy command from 'xxx.framework' to 'xxx.framework' 2) That command depends on command in Target 'xxx': script phase “Run Script”
RxSwift & RxCocoa