Photo by Danielle MacInnes on Unsplash

1. CaseIterable

enum City {
case new_york
case bei_jing
case vancouver
....
}
let cities: [City] = [.new_york, .bei_jing, .vancouver…


Photo by Jon Tyson on Unsplash

fallthrough


Photo by Mihály Köles on Unsplash


Photo by Hannah Tasker on Unsplash


Photo by KS KYUNG on Unsplash


https://icons8.com/icon/lrs3iOG232k5/swift

@propertyWrapper

@propertyWrapper 
struct Uppercased {
var wrappedValue: String {
didSet { wrappedValue = wrappedValue.uppercased() }
}
init(wrappedValue: String) {
self.wrappedValue = wrappedValue.uppercased()
}
}


Photo by Dominik Vanyi on Unsplash

XCTAssert(expression: Bool)

func testAssertion() {
let number = 2
XCTAssert(number > 1) // success
XCTAssert(number == 1) // failure
}

XCTAssertTrue(expression: Bool)


Photo by Jörg Angeli on Unsplash

Case 1

  1. If the user is suspicious, we will sign him/her out;
  2. If the user is unauthorized, we will sign him/her in, retrieve the location and the weather;
  3. If the user is authorized, we will retrieve the location…


Photo by Emma Matthews Digital Content Production on Unsplash

What’s a “God Class”?


Photo by Giorgio Trovato on Unsplash

What is a variable?

How to declare a variable?

var name = "Steve"
var age: Int = 35
var height: Double = 8.9
var isTall: Bool = {
return height > 7
}()

Dylan Chen

iOS Engineer, interested in Flutter. Nothing is better than solving complex problems with clean, elegant code. I have a passion for design and programming.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store