kkbox wwdc17 swift and foundation - liyao

Post on 22-Jan-2018

2.084 Views

Category:

Technology

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

WWDC17 讀書會Swift & Foundation

Liyao Chen1現在 2017.6.30

Swift & Foundation• What’s New in Swift

• What’s New in Foundation

• Efficient Interactions with Frameworks

• Modernizing Grand Central Dispatch Usage

2

Outlines

• 無痛升級

• New APIs

• Performance

3

無痛升級

4

無痛升級

• Swift Refactoring Support

• New Build System

• Copy on Write

• Exclusive Access to Memory

5

New Build System

6

New Build System

7

• Shard Build for Coverage Testing

• Indexing While Building

• Faster Generic Code

• Heap alloc -> Stack alloc

New Build System

8

Copy on Write

9

• Make it easier to reason about local variables

• Enable better programmer optimization

• Enable better compiler optimization

• Enable powerful new language features

Exclusive Access to Memory

10

Exclusive Access to Memory

11

Exclusive Access to Memory

12

13

14

15

New APIs

16

New APIs• Private function access control changed

• Class and Subtype Existential

• KeyPaths and KVO

• Encoding & Decoding

• Generics

• String

17

18

19

Key Paths and KVO

20

21

22

23

24

25

26

27

28

29

Encoding and Decoding

30

31

32

33

34

–Mantle, SwiftyJSON

35

36

String

37

38

39

40

41

42

43

44

Performance

45

Performance

• Memory

• Smaller Binaries

• CPU

46

Memory

47

48

49

50

51

52

53

54

55

56

57

Text layout and rendering

58

Text layout and rendering

59

Text layout and rendering

60

Text layout and rendering

61

Smaller Binaries

62

63

64

65

CPU

66

GCD

• Parallelism

• Concurrency

• Context switching

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

What Are Dispatch Sources

• In short, a dispatch source is an object which monitors for some type of event.

• When the event occurs, it automatically schedules a block for execution on a dispatch queue.

• https://www.mikeash.com/pyblog/friday-qa-2009-09-11-intro-to-grand-central-dispatch-part-iii-dispatch-sources.html

86

What Are Dispatch Sources

87

Custom event

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

Recap

• 無痛升級

• New APIs

• Performance

• Binary size, memory, CPU

108

Q and A

109

Liyao Chen現在

Swift & Foundation2017.6.30

top related