Lectures

· ios's blog


Syntax similar to Rust

Strings #

Loops #

Functions #

1func sayHello(to person: String) {
2  print("Hello \(person)")
3}
4sayHello(to: "Denis <3")

Enums #

1enum Compass {
2  case north east, south, west
3}
4let heading: Compass = .west

Structs #

Classes #

Generics #

Type constraints:

1struct DictionaryA<Key: Hashable, Value> {}
2struct DictionaryB<Key, Value> where Key : Hashable {}

Protocols #

Extensions #

1extension UIColor {
2  static var coolColor: UIColor {
3    return UIColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 1.0)
4  }
5}

Closures #

Collections #

UIKit #

Delegates #

1class MyViewController: UITableViewDelegate {
2  myTableView.delegate = self
3}

View Controller #

AppDelegate #

1func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
2 return true
3}

SceneDelegate #

Auto Layout #

Safe Area #

Constraints #

Intrinsic Sizes #

Hugging & Compressing #

Variants #

Views #

Scroll View #

Table View #

Collection Views #

Search Controller #

Animations #

1UIView.animate(withDuration: 2.0) {
2  view.alpha = 0
3}

Data changes #

Web access #

Concurrency #

SwiftUI #

Modifiers #

XCode #

Layout Views #

MVVM #

Storing Data #

Serialization #

File Manager #