Ash Furrow shares his recent real-world experience with Swift as a case study in an evaluation of Swift's production readiness. He provides a chance of taking advantage of the lessons they learned to make the best decisions about Swift.
7. TXS ;push return address back onto stack
LDY #$00 ;load Y with zero - will hold result
LOOP1 LDAA TEMP ;load A into TEMP
ANDA MASK ;AND A with Mask
BNE ADD1
BRA NONE1
ADD1 INY ;increment our counter of 1's
NONE1 LDAA TEMP ;reload accumulator A
LSL MASK ;Shift the mask's 1 bit left
BNE LOOP1 ;If we haven't finished our loop, branch
LDAA #$01 ;load new mask into A
STAA MASK ;store the reset mask into MASK
TSX ;pull of return address and store in X
PULA ;pull off A
STAA TEMP ;store the value into temp
TXS ;push return address back onto the stack
LOOP2 LDAA TEMP ;Load A into TEMP
ANDA MASK ;logical AND MASK with A
BNE ADD2 ;add one if we need to
BRA NONE2
ADD2 INY ;increment our counter of 1's
NONE2 LDAA TEMP
LSL MASK ;shift our mask left by one
BNE LOOP2 ;loop back until we've exhausted positions
STY TEMP ;store Y into TEMP - this is the number of 1's
LDAB TEMP ;load the number of 1's into B
LDAA #$10 ;load dec 16 into A
SBA ;A - B -> A same as 16 - B -> A
11. Criteria
1. No C baggage
2. Memory Managed
3. Native unicode strings
4. Native collections
5. Be concise
6. Named Parameters
12. Criteria
1. No C baggage
2. Memory Managed
3. Native unicode strings
4. Native collections
5. Be concise
6. Named Parameters
😋
😅
😃
😄
😍
😎
13. The Need for Swift
• Programming abstraction increases over time
• Objective-C has improved all it can
• Swift is the next step
• Revolution, not evolution
29. Index Paths
switch (indexPath.section, indexPath.row) {
case (0, let row):
// Executed for any section 0, row is row
case (let section, 0) where section % 2 == 1:
// Executed for first rows of odd all sections
case (let section, let row) where validate(section):
// Executed when validate() returns true
default:
// Executed on all other cases
}
30. Generics
• Define functions, structs, others in the abstract
• Create one instead of many
• Arrays, dictionaries, and sets are all generics