Engineering for Testability

Size: px
Start display at page:

Download "Engineering for Testability"

Transcription

1 Session Developer Tools #WWDC17 Engineering for Testability 414 Brian Croom, Xcode Engineer Greg Tracy, Xcode Engineer 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.

2 Engineering for Testability Testable app code Scalable test code

3 Engineering for Testability Testable app code Scalable test code

4 Engineering for Testability Testable app code Scalable test code

5 Testable App Code

6 Structure of a Unit Test

7 Structure of a Unit Test func testarraysorting() { let input = [1, 7, 6, 3, 10] let output = input.sorted() XCTAssertEqual(output, [1, 3, 6, 7, 10])

8 Structure of a Unit Test func testarraysorting() { let input = [1, 7, 6, 3, 10] let output = input.sorted() XCTAssertEqual(output, [1, 3, 6, 7, 10]) input

9 Structure of a Unit Test func testarraysorting() { let input = [1, 7, 6, 3, 10] let output = input.sorted() XCTAssertEqual(output, [1, 3, 6, 7, 10]) input Array.sorted

10 Structure of a Unit Test func testarraysorting() { let input = [1, 7, 6, 3, 10] let output = input.sorted() XCTAssertEqual(output, [1, 3, 6, 7, 10]) input Array.sorted output

11 Structure of a Unit Test input Array.sorted output

12 Structure of a Unit Test Prepare input input Array.sorted output

13 Structure of a Unit Test Prepare input Run the code being tested input Array.sorted output

14 Structure of a Unit Test Prepare input Run the code being tested Verify output input Array.sorted output

15 Characteristics of Testable Code

16 Characteristics of Testable Code Control over inputs

17 Characteristics of Testable Code Control over inputs Visibility into outputs

18 Characteristics of Testable Code Control over inputs Visibility into outputs No hidden state

19 Testability Techniques Protocols and parameterization Separating logic and effects

20 Protocols and Parameterization

21 Document Preview View Edit Open

22 @IBAction func opentapped(_ sender: Any) { let mode: String switch segmentedcontrol.selectedsegmentindex { case 0: mode = "view" case 1: mode = "edit" default: fatalerror("impossible case") let url = URL(string: "myappscheme://open?id=\(document.identifier)&mode=\(mode)")! if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionhandler: nil) else { handleurlerror()

23 @IBAction func opentapped(_ sender: Any) { let mode: String switch segmentedcontrol.selectedsegmentindex { case 0: mode = "view" case 1: mode = "edit" default: fatalerror("impossible case") let url = URL(string: "myappscheme://open?id=\(document.identifier)&mode=\(mode)")! if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionhandler: nil) else { handleurlerror()

24 @IBAction func opentapped(_ sender: Any) { let mode: String switch segmentedcontrol.selectedsegmentindex { case 0: mode = "view" case 1: mode = "edit" default: fatalerror("impossible case") let url = URL(string: "myappscheme://open?id=\(document.identifier)&mode=\(mode)")! if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionhandler: nil) else { handleurlerror()

25 @IBAction func opentapped(_ sender: Any) { let mode: String switch segmentedcontrol.selectedsegmentindex { case 0: mode = "view" case 1: mode = "edit" default: fatalerror("impossible case") let url = URL(string: "myappscheme://open?id=\(document.identifier)&mode=\(mode)")! if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionhandler: nil) else { handleurlerror()

26 @IBAction func opentapped(_ sender: Any) { let mode: String switch segmentedcontrol.selectedsegmentindex { case 0: mode = "view" case 1: mode = "edit" default: fatalerror("impossible case") let url = URL(string: "myappscheme://open?id=\(document.identifier)&mode=\(mode)")! if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionhandler: nil) else { handleurlerror()

27 Document Preview View Edit Open

28 Document Preview Document Editor App View Edit Open

29 func testopensdocumenturlwhenbuttonistapped() {

30 func testopensdocumenturlwhenbuttonistapped() { let controller = UIStoryboard(name: "Main", bundle: nil).instantiateviewcontroller(withidentifier: "Preview") as! PreviewViewController

31 func testopensdocumenturlwhenbuttonistapped() { let controller = UIStoryboard(name: "Main", bundle: nil).instantiateviewcontroller(withidentifier: "Preview") as! PreviewViewController controller.loadviewifneeded()

32 func testopensdocumenturlwhenbuttonistapped() { let controller = UIStoryboard(name: "Main", bundle: nil).instantiateviewcontroller(withidentifier: "Preview") as! PreviewViewController controller.loadviewifneeded() controller.segmentedcontrol.selectedsegmentindex = 1

33 func testopensdocumenturlwhenbuttonistapped() { let controller = UIStoryboard(name: "Main", bundle: nil).instantiateviewcontroller(withidentifier: "Preview") as! PreviewViewController controller.loadviewifneeded() controller.segmentedcontrol.selectedsegmentindex = 1 controller.document = Document(identifier: "TheID")

34 func testopensdocumenturlwhenbuttonistapped() { let controller = UIStoryboard(name: "Main", bundle: nil).instantiateviewcontroller(withidentifier: "Preview") as! PreviewViewController controller.loadviewifneeded() controller.segmentedcontrol.selectedsegmentindex = 1 controller.document = Document(identifier: TheID") controller.opentapped(controller.button)

35 func testopensdocumenturlwhenbuttonistapped() { let controller = UIStoryboard(name: "Main", bundle: nil).instantiateviewcontroller(withidentifier: "Preview") as! PreviewViewController controller.loadviewifneeded() controller.segmentedcontrol.selectedsegmentindex = 1 controller.document = Document(identifier: TheID") controller.opentapped(controller.button) //???

36 @IBAction func opentapped(_ sender: Any) { let mode: String switch segmentedcontrol.selectedsegmentindex { case 0: mode = "view" case 1: mode = "edit" default: fatalerror("impossible case") let url = URL(string: "myappscheme://open?id=\(document.identifier)&mode=\(mode)")! if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionhandler: nil) else { handleurlerror()

37 @IBAction func opentapped(_ sender: Any) { let mode: String switch segmentedcontrol.selectedsegmentindex { case 0: mode = "view" case 1: mode = "edit" default: fatalerror("impossible case") let url = URL(string: "myappscheme://open?id=\(document.identifier)&mode=\(mode)")! if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionhandler: nil) else { handleurlerror()

38 @IBAction func opentapped(_ sender: Any) { let mode: String switch segmentedcontrol.selectedsegmentindex { case 0: mode = "view" case 1: mode = "edit" default: fatalerror("impossible case") let url = URL(string: "myappscheme://open?id=\(document.identifier)&mode=\(mode)")! if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionhandler: nil) else { handleurlerror()

39 @IBAction func opentapped(_ sender: Any) { let mode: String switch segmentedcontrol.selectedsegmentindex { case 0: mode = "view" case 1: mode = "edit" default: fatalerror("impossible case") let url = URL(string: "myappscheme://open?id=\(document.identifier)&mode=\(mode)")! if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionhandler: nil) else { handleurlerror()

40 @IBAction func opentapped(_ sender: Any) { let mode: String switch segmentedcontrol.selectedsegmentindex { case 0: mode = "view" case 1: mode = "edit" default: fatalerror("impossible case") let url = URL(string: "myappscheme://open?id=\(document.identifier)&mode=\(mode)")! if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionhandler: nil) else { handleurlerror()

41 @IBAction func opentapped(_ sender: Any) { let mode: String switch segmentedcontrol.selectedsegmentindex { case 0: mode = "view" case 1: mode = "edit" default: fatalerror("impossible case") let url = URL(string: "myappscheme://open?id=\(document.identifier)&mode=\(mode)")! if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionhandler: nil) else { handleurlerror()

42 class DocumentOpener { enum OpenMode: String { case view case edit func open(_ document: Document, mode: OpenMode) { let modestring = mode.rawvalue let url = URL(string: "myappscheme://open?id=\(document.identifier)&mode=\(modestring)")! if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionhandler: nil) else { handleurlerror()

43 class DocumentOpener { enum OpenMode: String { case view case edit func open(_ document: Document, mode: OpenMode) { let modestring = mode.rawvalue let url = URL(string: "myappscheme://open?id=\(document.identifier)&mode=\(modestring)")! if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionhandler: nil) else { handleurlerror()

44 class DocumentOpener { enum OpenMode: String { case view case edit func open(_ document: Document, mode: OpenMode) { let modestring = mode.rawvalue let url = URL(string: "myappscheme://open?id=\(document.identifier)&mode=\(modestring)")! if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionhandler: nil) else { handleurlerror()

45 class DocumentOpener { enum OpenMode: String { case view case edit func open(_ document: Document, mode: OpenMode) { let modestring = mode.rawvalue let url = URL(string: "myappscheme://open?id=\(document.identifier)&mode=\(modestring)")! if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionhandler: nil) else { handleurlerror()

46 class DocumentOpener { enum OpenMode: String { case view case edit func open(_ document: Document, mode: OpenMode) { let modestring = mode.rawvalue let url = URL(string: "myappscheme://open?id=\(document.identifier)&mode=\(modestring)")! if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionhandler: nil) else { handleurlerror()

47 class DocumentOpener { let application: UIApplication init(application: UIApplication) { self.application = application /* */

48 class DocumentOpener { let application: UIApplication init(application: UIApplication = UIApplication.shared) { self.application = application /* */

49 class DocumentOpener { /* */ func open(_ document: Document, mode: OpenMode) { let modestring = mode.rawvalue let url = URL(string: "myappscheme://open?id=\(document.identifier)&mode=\(modestring)")! if application.canopenurl(url) { application.open(url, options: [:], completionhandler: nil) else { handleurlerror()

50 class DocumentOpener { /* */ func open(_ document: Document, mode: OpenMode) { let modestring = mode.rawvalue let url = URL(string: "myappscheme://open?id=\(document.identifier)&mode=\(modestring)")! if application.canopenurl(url) { application.open(url, options: [:], completionhandler: nil) else { handleurlerror()

51 func testdocumentopenerwhenitcanopen() { let app = /*??? */ let opener = DocumentOpener(application: app)

52 protocol URLOpening {

53 protocol URLOpening { func canopenurl(_ url: URL) -> Bool func open(_ url: URL, options: [String: Any], completionhandler: ((Bool) -> Void)?)

54 protocol URLOpening { func canopenurl(_ url: URL) -> Bool func open(_ url: URL, options: [String: Any], completionhandler: ((Bool) -> Void)?) extension UIApplication: URLOpening {

55 protocol URLOpening { func canopenurl(_ url: URL) -> Bool func open(_ url: URL, options: [String: Any], completionhandler: ((Bool) -> Void)?) extension UIApplication: URLOpening { // Nothing needed here!

56 class DocumentOpener { let application: UIApplication init(application: UIApplication = UIApplication.shared) { self.application = application /* */

57 class DocumentOpener { let urlopener: URLOpening init(urlopener: URLOpening = UIApplication.shared) { self.urlopener = urlopener /* */

58 class DocumentOpener { func open(_ document: Document, mode: OpenMode) { let modestring = mode.rawvalue let url = URL(string: "myappscheme://open?id=\(document.identifier)&mode=\(modestring)")! if application.canopenurl(url) { application.open(url, options: [:], completionhandler: nil) else { handleurlerror()

59 class DocumentOpener { func open(_ document: Document, mode: OpenMode) { let modestring = mode.rawvalue let url = URL(string: "myappscheme://open?id=\(document.identifier)&mode=\(modestring)")! if urlopener.canopenurl(url) { urlopener.open(url, options: [:], completionhandler: nil) else { handleurlerror()

60

61 class MockURLOpener: URLOpening {

62 class MockURLOpener: URLOpening { func canopenurl(_ url: URL) -> Bool { func open(_ url: URL, options: [String: Any], completionhandler: ((Bool) -> Void)?) {

63 class MockURLOpener: URLOpening { var canopen = false func canopenurl(_ url: URL) -> Bool { return canopen func open(_ url: URL, options: [String: Any], completionhandler: ((Bool) -> Void)?) {

64 class MockURLOpener: URLOpening { var canopen = false var openedurl: URL? func canopenurl(_ url: URL) -> Bool { return canopen func open(_ url: URL, options: [String: Any], completionhandler: ((Bool) -> Void)?) { openedurl = url

65 func testdocumentopenerwhenitcanopen() {

66 func testdocumentopenerwhenitcanopen() { let urlopener = MockURLOpener() urlopener.canopen = true

67 func testdocumentopenerwhenitcanopen() { let urlopener = MockURLOpener() urlopener.canopen = true let documentopener = DocumentOpener(urlOpener: urlopener)

68 func testdocumentopenerwhenitcanopen() { let urlopener = MockURLOpener() urlopener.canopen = true let documentopener = DocumentOpener(urlOpener: urlopener) documentopener.open(document(identifier: "TheID"), mode:.edit)

69 func testdocumentopenerwhenitcanopen() { let urlopener = MockURLOpener() urlopener.canopen = true let documentopener = DocumentOpener(urlOpener: urlopener) documentopener.open(document(identifier: "TheID"), mode:.edit) XCTAssertEqual(urlOpener.openedURL, URL(string: "myappscheme://open?id=theid&mode=edit"))

70 func testdocumentopenerwhenitcanopen() { let urlopener = MockURLOpener() urlopener.canopen = true let documentopener = DocumentOpener(urlOpener: urlopener) documentopener.open(document(identifier: "TheID"), mode:.edit) XCTAssertEqual(urlOpener.openedURL, URL(string: "myappscheme://open?id=theid&mode=edit"))

71 Protocols and Parameterization

72 Protocols and Parameterization Reduce references to shared instances

73 Protocols and Parameterization Reduce references to shared instances Accept parameterized input

74 Protocols and Parameterization Reduce references to shared instances Accept parameterized input Introduce a protocol

75 Protocols and Parameterization Reduce references to shared instances Accept parameterized input Introduce a protocol Create a testing implementation

76 Separating Logic and Effects

77 class OnDiskCache {

78 class OnDiskCache { struct Item { let path: String let age: TimeInterval let size: Int var currentitems: Set<Item> { /* */ /* */

79 class OnDiskCache { struct Item { let path: String let age: TimeInterval let size: Int var currentitems: Set<Item> { /* */ /* */

80 class OnDiskCache { /* */ func cleancache(maxsize: Int) throws {

81 class OnDiskCache { /* */ func cleancache(maxsize: Int) throws { let sorteditems = self.currentitems.sorted { $0.age < $1.age

82 class OnDiskCache { /* */ func cleancache(maxsize: Int) throws { let sorteditems = self.currentitems.sorted { $0.age < $1.age var cumulativesize = 0 for item in sorteditems {

83 class OnDiskCache { /* */ func cleancache(maxsize: Int) throws { let sorteditems = self.currentitems.sorted { $0.age < $1.age var cumulativesize = 0 for item in sorteditems { cumulativesize += item.size

84 class OnDiskCache { /* */ func cleancache(maxsize: Int) throws { let sorteditems = self.currentitems.sorted { $0.age < $1.age var cumulativesize = 0 for item in sorteditems { cumulativesize += item.size if cumulativesize > maxsize { try FileManager.default.removeItem(atPath: item.path)

85 class OnDiskCache { /* */ func cleancache(maxsize: Int) throws { let sorteditems = self.currentitems.sorted { $0.age < $1.age var cumulativesize = 0 for item in sorteditems { cumulativesize += item.size if cumulativesize > maxsize { try FileManager.default.removeItem(atPath: item.path)

86 Inputs and Outputs maxsize cleancache

87 Inputs and Outputs maxsize cleancache currentitems

88 Inputs and Outputs maxsize cleancache

89 Inputs and Outputs maxsize cleancache

90 Inputs and Outputs maxsize cleancache TestFileManager TestFileManager

91 Inputs and Outputs cleancache

92 Inputs and Outputs cleancache CleanupPolicy

93 protocol CleanupPolicy {

94 protocol CleanupPolicy { func itemstoremove(from items: Set<OnDiskCache.Item>) -> Set<OnDiskCache.Item>

95 protocol CleanupPolicy { func itemstoremove(from items: Set<OnDiskCache.Item>) -> Set<OnDiskCache.Item> class OnDiskCache { func cleancache(maxsize: Int) throws { /* */

96 struct MaxSizeCleanupPolicy: CleanupPolicy {

97 struct MaxSizeCleanupPolicy: CleanupPolicy { let maxsize: Int

98 struct MaxSizeCleanupPolicy: CleanupPolicy { let maxsize: Int func itemstoremove(from items: Set<OnDiskCache.Item>) -> Set<OnDiskCache.Item> {

99 struct MaxSizeCleanupPolicy: CleanupPolicy { let maxsize: Int func itemstoremove(from items: Set<OnDiskCache.Item>) -> Set<OnDiskCache.Item> { var itemstoremove = Set<OnDiskCache.Item>() var cumulativesize = 0 return itemstoremove

100 struct MaxSizeCleanupPolicy: CleanupPolicy { let maxsize: Int func itemstoremove(from items: Set<OnDiskCache.Item>) -> Set<OnDiskCache.Item> { var itemstoremove = Set<OnDiskCache.Item>() var cumulativesize = 0 let sorteditems = items.sorted { $0.age < $1.age for item in sorteditems { return itemstoremove

101 struct MaxSizeCleanupPolicy: CleanupPolicy { let maxsize: Int func itemstoremove(from items: Set<OnDiskCache.Item>) -> Set<OnDiskCache.Item> { var itemstoremove = Set<OnDiskCache.Item>() var cumulativesize = 0 let sorteditems = allitems.sorted { $0.age < $1.age for item in sorteditems { cumulativesize += item.size return itemstoremove

102 struct MaxSizeCleanupPolicy: CleanupPolicy { let maxsize: Int func itemstoremove(from items: Set<OnDiskCache.Item>) -> Set<OnDiskCache.Item> { var itemstoremove = Set<OnDiskCache.Item>() var cumulativesize = 0 let sorteditems = allitems.sorted { $0.age < $1.age for item in sorteditems { cumulativesize += item.size if cumulativesize > maxsize { itemstoremove.insert(item) return itemstoremove

103 struct MaxSizeCleanupPolicy: CleanupPolicy { let maxsize: Int func itemstoremove(from items: Set<OnDiskCache.Item>) -> Set<OnDiskCache.Item> { var itemstoremove = Set<OnDiskCache.Item>() var cumulativesize = 0 let sorteditems = allitems.sorted { $0.age < $1.age for item in sorteditems { cumulativesize += item.size if cumulativesize > maxsize { itemstoremove.insert(item) return itemstoremove

104 struct MaxSizeCleanupPolicy: CleanupPolicy { let maxsize: Int func itemstoremove(from items: Set<OnDiskCache.Item>) -> Set<OnDiskCache.Item> { var itemstoremove = Set<OnDiskCache.Item>() var cumulativesize = 0 let sorteditems = allitems.sorted { $0.age < $1.age for item in sorteditems { cumulativesize += item.size if cumulativesize > maxsize { itemstoremove.insert(item) return itemstoremove

105 struct MaxSizeCleanupPolicy: CleanupPolicy { let maxsize: Int func itemstoremove(from items: Set<OnDiskCache.Item>) -> Set<OnDiskCache.Item> { var itemstoremove = Set<OnDiskCache.Item>() var cumulativesize = 0 let sorteditems = allitems.sorted { $0.age < $1.age for item in sorteditems { cumulativesize += item.size if cumulativesize > maxsize { itemstoremove.insert(item) return itemstoremove

106 Inputs and Outputs maxsize items CleanupPolicy Set<OnDiskCache.Item>

107 func testmaxsizecleanuppolicy() {

108 func testmaxsizecleanuppolicy() { let inputitems = Set([ OnDiskCache.Item(path: "/item1", age: 5, size: 7), OnDiskCache.Item(path: "/item2", age: 3, size: 2), OnDiskCache.Item(path: "/item3", age: 9, size: 9) ])

109 func testmaxsizecleanuppolicy() { let inputitems = Set([ OnDiskCache.Item(path: "/item1", age: 5, size: 7), OnDiskCache.Item(path: "/item2", age: 3, size: 2), OnDiskCache.Item(path: "/item3", age: 9, size: 9) ]) let outputitems = MaxSizeCleanupPolicy(maxSize: 10).itemsToRemove(from: inputitems)

110 func testmaxsizecleanuppolicy() { let inputitems = Set([ OnDiskCache.Item(path: "/item1", age: 5, size: 7), OnDiskCache.Item(path: "/item2", age: 3, size: 2), OnDiskCache.Item(path: "/item3", age: 9, size: 9) ]) let outputitems = MaxSizeCleanupPolicy(maxSize: 10).itemsToRemove(from: inputitems) XCTAssertEqual(outputItems, [OnDiskCache.Item(path: "/item3", age: 9, size: 9)])

111 class OnDiskCache { /* */ func cleancache(policy: CleanupPolicy) throws { let itemstoremove = policy.itemstoremove(from: self.currentitems) for item in itemstoremove { try FileManager.default.removeItem(atPath: item.path)

112 class OnDiskCache { /* */ func cleancache(policy: CleanupPolicy) throws { let itemstoremove = policy.itemstoremove(from: self.currentitems) for item in itemstoremove { try FileManager.default.removeItem(atPath: item.path)

113 class OnDiskCache { /* */ func cleancache(policy: CleanupPolicy) throws { let itemstoremove = policy.itemstoremove(from: self.currentitems) for item in itemstoremove { try FileManager.default.removeItem(atPath: item.path)

114 Separating Logic and Effects

115 Separating Logic and Effects Extract algorithms

116 Separating Logic and Effects Extract algorithms Functional style with value types

117 Separating Logic and Effects Extract algorithms Functional style with value types Thin layer on top to execute effects

118 Testability Techniques Protocols and parameterization Separating logic and effects

119 Scalable Test Code Greg Tracy, Xcode Engineer

120

121 Balance between UI and unit tests

122 Balance between UI and unit tests Code to help UI tests scale

123 Balance between UI and unit tests Code to help UI tests scale Quality of test code

124 Striking the right balance between UI and unit tests

125 Testing Pyramid

126 UI Tests

127 Unit Tests

128 Testing Pyramid UI Unit

129 Testing Pyramid UI Integration Unit

130 Testing Pyramid UI Unit

131 Higher Lower Testing Pyramid Maintenance UI Maintenance Unit

132 Higher Lower Testing Pyramid Maintenance UI Maintenance Unit

133 Balance between UI and Unit Tests

134 Balance between UI and Unit Tests Unit tests great for testing small, hard-to-reach code paths

135 Balance between UI and Unit Tests Unit tests great for testing small, hard-to-reach code paths UI tests are better at testing integration of larger pieces

136 Writing code to help UI tests scale

137 Code to Help UI Tests Scale

138 Code to Help UI Tests Scale Abstracting UI element queries

139 Code to Help UI Tests Scale Abstracting UI element queries Creating objects and utility functions

140 Code to Help UI Tests Scale Abstracting UI element queries Creating objects and utility functions Utilizing keyboard shortcuts

141 Code to Help UI Tests Scale Abstracting UI element queries Creating objects and utility functions Utilizing keyboard shortcuts

142 app.buttons["blue"].tap() app.buttons["red"].tap() app.buttons["yellow"].tap() app.buttons["green"].tap() app.buttons["purple"].tap() app.buttons["orange"].tap() app.buttons["pink"].tap()

143 app.buttons["blue"].tap() app.buttons["red"].tap() app.buttons["yellow"].tap() app.buttons["green"].tap() app.buttons["purple"].tap() app.buttons["orange"].tap() app.buttons["pink"].tap()

144 func tapbutton(_ color: String) { app.buttons[color].tap() app.buttons["blue"].tap() app.buttons["red"].tap() app.buttons["yellow"].tap() app.buttons["green"].tap() app.buttons["purple"].tap() app.buttons["orange"].tap() app.buttons["pink"].tap()

145 func tapbutton(_ color: String) { app.buttons[color].tap() tapbutton("blue") tapbutton("red") tapbutton("yellow") tapbutton("green") tapbutton("purple") tapbutton("orange") tapbutton("pink")

146 tapbutton("blue") tapbutton("red") tapbutton("yellow") tapbutton("green") tapbutton("purple") tapbutton("orange") tapbutton("pink")

147 let colors = ["blue", "red", "yellow", "green", "purple", "orange", "pink"] for color in colors { tapbutton(color)

148 Abstracting UI Element Queries

149 Abstracting UI Element Queries Store parts of queries in a variable

150 Abstracting UI Element Queries Store parts of queries in a variable Wrap complex queries in utility methods

151 Abstracting UI Element Queries Store parts of queries in a variable Wrap complex queries in utility methods Reduces noise and clutter in UI test

152 Code to Help UI Tests Scale Abstracting UI element queries Creating objects and utility functions Utilizing keyboard shortcuts

153 Code to Help UI Tests Scale Abstracting UI element queries Creating objects and utility functions Utilizing keyboard shortcuts

154 func testgamewithdifficultybeginnerandsoundoff() { app.navigationbars["game.gameview"].buttons["settings"].tap() app.buttons["difficulty"].tap() app.buttons["beginner"].tap() app.navigationbars.buttons["back"].tap() app.buttons["sound"].tap() app.buttons["off"].tap() app.navigationbars.buttons["back"].tap() app.navigationbars.buttons["back"].tap() // test code

155 func testgamewithdifficultybeginnerandsoundoff() { app.navigationbars["game.gameview"].buttons["settings"].tap() app.buttons["difficulty"].tap() app.buttons["beginner"].tap() app.navigationbars.buttons["back"].tap() app.buttons["sound"].tap() app.buttons["off"].tap() app.navigationbars.buttons["back"].tap() app.navigationbars.buttons["back"].tap() // test code

156 func testgamewithdifficultybeginnerandsoundoff() { app.navigationbars["game.gameview"].buttons["settings"].tap() app.buttons["difficulty"].tap() app.buttons["beginner"].tap() app.navigationbars.buttons["back"].tap() app.buttons["sound"].tap() app.buttons["off"].tap() app.navigationbars.buttons["back"].tap() app.navigationbars.buttons["back"].tap() // test code

157 func testgamewithdifficultybeginnerandsoundoff() { app.navigationbars["game.gameview"].buttons["settings"].tap() app.buttons["difficulty"].tap() app.buttons["beginner"].tap() app.navigationbars.buttons["back"].tap() app.buttons["sound"].tap() app.buttons["off"].tap() app.navigationbars.buttons["back"].tap() app.navigationbars.buttons["back"].tap() // test code

158 func setdifficulty(_ difficulty: String) { app.buttons["difficulty"].tap() app.buttons[difficulty].tap() app.navigationbars.buttons["back"].tap()

159 func setdifficulty(_ difficulty: String) { app.buttons["difficulty"].tap() app.buttons[difficulty].tap() app.navigationbars.buttons["back"].tap() func setsound(_ sound: String) { app.buttons["sound"].tap() app.buttons[sound].tap() app.navigationbars.buttons["back"].tap()

160 func setdifficulty(_ difficulty: String) { // code func setsound(_ sound: String) { // code

161 enum Difficulty { case beginner case intermediate case veteran enum Sound { case on case off func setdifficulty(_ difficulty: String) { // code func setsound(_ sound: String) { // code

162 enum Difficulty { case beginner case intermediate case veteran enum Sound { case on case off func setdifficulty(_ difficulty: Difficulty) { // code func setsound(_ sound: Sound) { // code

163 func testgamewithdifficultybeginnerandsoundoff() { app.navigationbars["game.gameview"].buttons["settings"].tap() app.buttons["difficulty"].tap() app.buttons["beginner"].tap() app.navigationbars.buttons["back"].tap() app.buttons["sound"].tap() app.buttons["off"].tap() app.navigationbars.buttons["back"].tap() app.navigationbars.buttons["back"].tap() // test code

164 func testgamewithdifficultybeginnerandsoundoff() { app.navigationbars["game.gameview"].buttons["settings"].tap() setdifficulty(.beginner) setsound(.off) app.navigationbars.buttons["back"].tap() // test code

165 func testgamewithdifficultybeginnerandsoundoff() { app.navigationbars["game.gameview"].buttons["settings"].tap() setdifficulty(.beginner) setsound(.off) app.navigationbars.buttons["back"].tap() // test code

166 class GameApp: XCUIApplication {

167 class GameApp: XCUIApplication { enum Difficulty { /* cases */ enum Sound { /* cases */

168 class GameApp: XCUIApplication { enum Difficulty { /* cases */ enum Sound { /* cases */ func setdifficulty(_ difficulty: Difficulty) { /* code */ func setsound(_ sound: Sound) { /* code */

169 class GameApp: XCUIApplication { enum Difficulty { /* cases */ enum Sound { /* cases */ func setdifficulty(_ difficulty: Difficulty) { /* code */ func setsound(_ sound: Sound) { /* code */ func configuresettings(difficulty: Difficulty, sound: Sound) {

170 class GameApp: XCUIApplication { enum Difficulty { /* cases */ enum Sound { /* cases */ func setdifficulty(_ difficulty: Difficulty) { /* code */ func setsound(_ sound: Sound) { /* code */ func configuresettings(difficulty: Difficulty, sound: Sound) { app.navigationbars["game.gameview"].buttons["settings"].tap() setdifficulty(difficulty) setsound(sound) app.navigationbars.buttons["back"].tap()

171 func testgamewithdifficultybeginnerandsoundoff() { app.navigationbars["game.gameview"].buttons["settings"].tap() setdifficulty(.beginner) setsound(.off) app.navigationbars.buttons["back"].tap() // test code

172 func testgamewithdifficultybeginnerandsoundoff() { GameApp().configureSettings(difficulty:.beginner, sound:.off) // test code

173 Creating Objects and Utility Functions

174 Creating Objects and Utility Functions Encapsulate common testing workflows

175 Creating Objects and Utility Functions Encapsulate common testing workflows Cross-platform code sharing

176 Creating Objects and Utility Functions Encapsulate common testing workflows Cross-platform code sharing Improves maintainability

177 class GameApp: XCUIApplication { NEW enum Difficulty { /* cases */ enum Sound { /* cases */ func setdifficulty(_ difficulty: Difficulty) { /* code */ func setsound(_ sound: Sound) { /* code */ func configuresettings(difficulty: Difficulty, sound: Sound) { app.navigationbars["game.gameview"].buttons["settings"].tap() setdifficulty(difficulty) setsound(sound) app.navigationbars.buttons["back"].tap()

178 class GameApp: XCUIApplication { NEW enum Difficulty { /* cases */ enum Sound { /* cases */ func setdifficulty(_ difficulty: Difficulty) { /* code */ func setsound(_ sound: Sound) { /* code */ func configuresettings(difficulty: Difficulty, sound: Sound) { XCTContext.runActivity(named: Configure Settings: \(difficulty), \(sound) ) { _ in app.navigationbars["game.gameview"].buttons["settings"].tap() setdifficulty(difficulty) setsound(sound) app.navigationbars.buttons[ Back"].tap()

179 func testgamewithdifficultybeginnerandsoundoff() { NEW GameApp().configureSettings(difficulty:.beginner, sound:.off) // test code

180 func testgamewithdifficultybeginnerandsoundoff() { NEW GameApp().configureSettings(difficulty:.beginner, sound:.off) // test code

181 func testgamewithdifficultybeginnerandsoundoff() { NEW GameApp().configureSettings(difficulty:.beginner, sound:.off) // test code

182 func testgamewithdifficultybeginnerandsoundoff() { NEW GameApp().configureSettings(difficulty:.beginner, sound:.off) // test code What s New in Testing WWDC 2017

183 Code to Help UI Tests Scale Abstracting UI element queries Creating objects and utility functions Utilizing keyboard shortcuts

184 Code to Help UI Tests Scale Abstracting UI element queries Creating objects and utility functions Utilizing keyboard shortcuts

185

186

187 let menubarsquery = app.menubars menubarsquery.menubaritems["format"].click() menubarsquery.menuitems["font"].click() menubarsquery.menuitems["show Colors"].click()

188 let menubarsquery = app.menubars menubarsquery.menubaritems["format"].click() menubarsquery.menuitems["font"].click() menubarsquery.menuitems["show Colors"].click()

189 let menubarsquery = app.menubars menubarsquery.menubaritems["format"].click() menubarsquery.menuitems["font"].click() menubarsquery.menuitems["show Colors"].click()

190 let menubarsquery = app.menubars menubarsquery.menubaritems["format"].click() menubarsquery.menuitems["font"].click() menubarsquery.menuitems["show Colors"].click()

191 let menubarsquery = app.menubars menubarsquery.menubaritems["format"].click() menubarsquery.menuitems["font"].click() menubarsquery.menuitems["show Colors"].click()

192 app.typekey("c", modifierflags:[.command,.shift])

193 func showcolors() { app.typekey("c", modifierflags:[.command,.shift])

194 func testchangecolor() { let menubarsquery = app.menubars menubarsquery.menubaritems["format"].click() menubarsquery.menuitems["font"].click() menubarsquery.menuitems["show Colors"].click() // test code

195 func testchangecolor() { showcolors() // test code

196 Keyboard Shortcuts for UI Tests

197 Keyboard Shortcuts for UI Tests Avoid working through menu bar for macos

198 Keyboard Shortcuts for UI Tests Avoid working through menu bar for macos Make code more compact

199 Treat your test code with the same amount of care as your app code

200 Quality of Test Code

201 Quality of Test Code Important to consider even though it isn't shipping

202 Quality of Test Code Important to consider even though it isn't shipping Test code should support the evolution of your app

203 Quality of Test Code Important to consider even though it isn't shipping Test code should support the evolution of your app Coding principles in app code also apply to test code

204 Code reviews for test code, not code reviews with test code

205 Quality of Test Code App Code Test Code

206 Quality of Test Code Test App Code

207 Quality of Test Code

208 Quality of Test Code Code

209 More Information

210 Related Sessions What s New in Testing WWDC 2017 Advanced Testing and Continuous Integration WWDC 2016 UI Testing in Xcode WWDC 2015 Testing in Xcode 6 WWDC 2014

211 Labs Xcode Open Hours Technology Lab K Friday 1:50PM 4:00PM

212

Using and Extending the Xcode Source Editor

Using and Extending the Xcode Source Editor Developer Tools #WWDC16 Using and Extending the Xcode Source Editor Session 414 Mike Swingler Xcode Infrastructure and Editors Chris Hanson Xcode Infrastructure and Editors 2016 Apple Inc. All rights reserved.

More information

What s New in imessage Apps

What s New in imessage Apps Session App Frameworks #WWDC17 What s New in imessage Apps 234 Eugene Bistolas, Messages Engineer Jay Chae, Messages Engineer Stephen Lottermoser, Messages Engineer 2017 Apple Inc. All rights reserved.

More information

Enhancing your apps for the next dimension of touch

Enhancing your apps for the next dimension of touch App Frameworks #WWDC16 A Peek at 3D Touch Enhancing your apps for the next dimension of touch Session 228 Tyler Fox UIKit Frameworks Engineer Peter Hajas UIKit Frameworks Engineer 2016 Apple Inc. All rights

More information

Managing Documents In Your ios Apps

Managing Documents In Your ios Apps Session #WWDC18 Managing Documents In Your ios Apps 216 Brandon Tennant, Software Engineer Thomas Deniau, Software Engineer Rony Fadel, Software Engineer 2018 Apple Inc. All rights reserved. Redistribution

More information

Data Delivery with Drag and Drop

Data Delivery with Drag and Drop Session App Frameworks #WWDC17 Data Delivery with Drag and Drop 227 Dave Rahardja, UIKit Tanu Singhal, UIKit 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted without

More information

Building Faster in Xcode

Building Faster in Xcode #WWDC18 Building Faster in Xcode Session 408 David Owens, Xcode Engineer Jordan Rose, Swift Engineer 2018 Apple Inc. All rights reserved. Redistribution or public display not permitted without written

More information

Implementing UI Designs in Interface Builder

Implementing UI Designs in Interface Builder Developer Tools #WWDC15 Implementing UI Designs in Interface Builder Session 407 Kevin Cathey Interface Builder Engineer Tony Ricciardi Interface Builder Engineer 2015 Apple Inc. All rights reserved. Redistribution

More information

Introduction to Siri Shortcuts

Introduction to Siri Shortcuts #WWDC8 Introduction to Siri Shortcuts Session 2 Ari Weinstein, Siri Willem Mattelaer, Siri 208 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission

More information

Creating Audio Apps for watchos

Creating Audio Apps for watchos Session #WWDC18 Creating Audio Apps for watchos 504 Neil Desai, watchos Frameworks Engineer 2018 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission

More information

What s New in MapKit. App Frameworks #WWDC17. Fredrik Olsson

What s New in MapKit. App Frameworks #WWDC17. Fredrik Olsson Session App Frameworks #WWDC17 What s New in MapKit 237 Fredrik Olsson 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple. MKMapView.mapType.standard

More information

Getting the Most Out of HealthKit

Getting the Most Out of HealthKit App Frameworks #WWDC16 Getting the Most Out of HealthKit What s new and best practices Session 209 Matthew Salesi ios Software Engineer Joefrey Kibuule ios Software Engineer 2016 Apple Inc. All rights

More information

What s New in Xcode App Signing

What s New in Xcode App Signing Developer Tools #WWDC16 What s New in Xcode App Signing Developing and distributing Session 401 Joshua Pennington Tools Engineering Manager Itai Rom Tools Engineer 2016 Apple Inc. All rights reserved.

More information

Monetize and Promote Your App with iad

Monetize and Promote Your App with iad Media #WWDC15 Monetize and Promote Your App with iad From design to launch Session 503 Carol Teng Shashank Phadke 2015 Apple Inc. All rights reserved. Redistribution or public display not permitted without

More information

What s New in watchos

What s New in watchos Session App Frameworks #WWDC17 What s New in watchos 205 Ian Parks, watchos Engineering 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from

More information

What's New in Core Spotlight

What's New in Core Spotlight Session System Frameworks #WWDC17 What's New in Core Spotlight Search on macos and ios 231 John Hörnkvist, Spotlight Lyn Fong, Spotlight 2017 Apple Inc. All rights reserved. Redistribution or public display

More information

Understanding Undefined Behavior

Understanding Undefined Behavior Session Developer Tools #WWDC17 Understanding Undefined Behavior 407 Fred Riss, Clang Team Ryan Govostes, Security Engineering and Architecture Team Anna Zaks, Program Analysis Team 2017 Apple Inc. All

More information

Mastering UIKit on tvos

Mastering UIKit on tvos App Frameworks #WWDC16 Mastering UIKit on tvos Session 210 Justin Voss UIKit Engineer 2016 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from

More information

What s New in Core Data?

What s New in Core Data? Session App Frameworks #WWDC17 What s New in Core? Persisting since 2004 210 Melissa Turner, Core Engineer Rishi Verma, Core Engineer 2017 Apple Inc. All rights reserved. Redistribution or public display

More information

Extending Your Apps with SiriKit

Extending Your Apps with SiriKit App Frameworks #WWDC16 Extending Your Apps with SiriKit Session 225 Vineet Khosla SiriKit Engineering Diana Huang SiriKit Engineering Scott Andrus SiriKit Engineering 2016 Apple Inc. All rights reserved.

More information

What s New in Testing

What s New in Testing #WWDC18 What s New in Testing Session 403 Honza Dvorsky, Xcode Engineer Ethan Vaughan, Xcode Engineer 2018 Apple Inc. All rights reserved. Redistribution or public display not permitted without written

More information

Seamless Linking to Your App

Seamless Linking to Your App App Frameworks #WWDC15 Seamless Linking to Your App Session 509 Conrad Shultz Safari and WebKit Software Engineer Jonathan Grynspan Core Services Software Engineer 2015 Apple Inc. All rights reserved.

More information

Advanced Notifications

Advanced Notifications System Frameworks #WWDC16 Advanced Notifications Session 708 Michele Campeotto ios Notifications 2016 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission

More information

Building for Voice with Siri Shortcuts

Building for Voice with Siri Shortcuts #WWDC18 Building for Voice with Siri Shortcuts Session 214 Amit Jain, Siri Ayaka Nonaka, Siri 2018 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission

More information

What s New in SiriKit

What s New in SiriKit Session App Frameworks #WWDC17 What s New in SiriKit 214 Sirisha Yerroju, SiriKit Engineer Tin Tran, SiriKit Engineer 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted

More information

Core ML in Depth. System Frameworks #WWDC17. Krishna Sridhar, Core ML Zach Nation, Core ML

Core ML in Depth. System Frameworks #WWDC17. Krishna Sridhar, Core ML Zach Nation, Core ML System Frameworks #WWDC17 Core ML in Depth Krishna Sridhar, Core ML Zach Nation, Core ML 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from

More information

Integrating Apps and Content with AR Quick Look

Integrating Apps and Content with AR Quick Look Session #WWDC18 Integrating Apps and Content with AR Quick Look 603 David Lui, ARKit Engineering Dave Addey, ARKit Engineering 2018 Apple Inc. All rights reserved. Redistribution or public display not

More information

imessage Apps and Stickers, Part 2

imessage Apps and Stickers, Part 2 App Frameworks #WWDC16 imessage Apps and Stickers, Part 2 Interactive Messages Session 224 Alex Carter Messages Engineer Stephen Lottermoser Messages Engineer 2016 Apple Inc. All rights reserved. Redistribution

More information

Your Apps and the Future of macos Security

Your Apps and the Future of macos Security #WWDC18 Your Apps and the Future of macos Security Pierre-Olivier Martel, Security Engineering Manager Kelly Yancey, OS Security Garrett Jacobson, Trusted Execution 2018 Apple Inc. All rights reserved.

More information

CarPlay Audio and Navigation Apps

CarPlay Audio and Navigation Apps #WWDC18 CarPlay Audio and Navigation Apps Tunes and turns Jonathan Hersh, ios Car Experience Albert Wan, ios Car Experience Mike Knippers, ios Car Experience 2018 Apple Inc. All rights reserved. Redistribution

More information

Using Grouped Notifications

Using Grouped Notifications #WWDC18 Using Grouped Notifications Session 711 Michele Campeotto, ios User Notifications 2018 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission

More information

Quick Interaction Techniques for watchos

Quick Interaction Techniques for watchos App Frameworks #WWDC16 Quick Interaction Techniques for watchos Session 211 Tom Witkin watchos Engineer Miguel Sanchez watchos Engineer 2016 Apple Inc. All rights reserved. Redistribution or public display

More information

App Extension Best Practices

App Extension Best Practices App Frameworks #WWDC15 App Extension Best Practices Session 224 Sophia Teutschler UIKit Engineer Ian Baird CoreOS Engineer 2015 Apple Inc. All rights reserved. Redistribution or public display not permitted

More information

Creating Extensions for ios and OS X, Part Two

Creating Extensions for ios and OS X, Part Two Frameworks #WWDC14 Creating Extensions for ios and OS X, Part Two Architecture Session 217 Damien Sorresso Overloaded Operator 2014 Apple Inc. All rights reserved. Redistribution or public display not

More information

Media and Gaming Accessibility

Media and Gaming Accessibility Session System Frameworks #WWDC17 Media and Gaming Accessibility 217 Greg Hughes, Software Engineering Manager Charlotte Hill, Software Engineer 2017 Apple Inc. All rights reserved. Redistribution or public

More information

What s New in Notifications

What s New in Notifications System Frameworks #WWDC15 What s New in Notifications Session 720 Michele Campeotto ios Notifications Gokul Thirumalai Apple Push Notification Service 2015 Apple Inc. All rights reserved. Redistribution

More information

Mastering Drag and Drop

Mastering Drag and Drop Session App Frameworks #WWDC17 Mastering Drag and Drop 213 Tom Adriaenssen, UIKit Wenson Hsieh, WebKit Robb Böhnke, UIKit 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted

More information

Introducing On Demand Resources

Introducing On Demand Resources App Frameworks #WWDC15 Introducing On Demand Resources An element of App Thinning Session 214 Steve Lewallen Frameworks Engineering Tony Parker Cocoa Frameworks 2015 Apple Inc. All rights reserved. Redistribution

More information

Building the App - Part 5 - Adding a Link

Building the App - Part 5 - Adding a Link Unit 4 - Coding For Your App Copy and Paste the code below exactly where the tutorials tell you. DO NOT COPY TEXT IN RED. Building the App - Part 5 - Adding a Link XCODE 7 @IBAction func Button1(_ sender:

More information

What s New in Cocoa for macos

What s New in Cocoa for macos Session #WWDC18 What s New in Cocoa for macos 209 Ali Ozer, Cocoa Frameworks Chris Dreessen, Cocoa Frameworks Jesse Donaldson, Cocoa Frameworks 2018 Apple Inc. All rights reserved. Redistribution or public

More information

Writing Energy Efficient Apps

Writing Energy Efficient Apps Session App Frameworks #WWDC17 Writing Energy Efficient Apps 238 Daniel Schucker, Software Power Engineer Prajakta Karandikar, Software Power Engineer 2017 Apple Inc. All rights reserved. Redistribution

More information

Settings. Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder

Settings. Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder Settings Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder Mobile Application Development in ios 1 Outline In-app settings UserDefaults Device settings

More information

Building Apps with Dynamic Type

Building Apps with Dynamic Type Session App Frameworks #WWDC17 Building Apps with Dynamic Type 245 Clare Kasemset, Software Engineering Manager Nandini Sundar, Software Engineer 2017 Apple Inc. All rights reserved. Redistribution or

More information

Introducing Password AutoFill for Apps

Introducing Password AutoFill for Apps Session App Frameworks #WWDC17 Introducing Password AutoFill for Apps Reducing friction for your users 206 Ricky Mondello, ios Engineer 2017 Apple Inc. All rights reserved. Redistribution or public display

More information

WatchKit In-Depth, Part 2

WatchKit In-Depth, Part 2 App Frameworks #WWDC15 WatchKit In-Depth, Part 2 Session 208 Nathan de Vries watchos Engineer Chloe Chang watchos Engineer 2015 Apple Inc. All rights reserved. Redistribution or public display not permitted

More information

Enabling Your App for CarPlay

Enabling Your App for CarPlay Session App Frameworks #WWDC17 Enabling Your App for CarPlay 719 Albert Wan, CarPlay Engineering 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission

More information

User Interfaces. Lecture 15. Application Programming on Mac OS. Hamza Bennani September 4, 2018

User Interfaces. Lecture 15. Application Programming on Mac OS. Hamza Bennani September 4, 2018 User Interfaces Lecture 15 Application Programming on Mac OS Hamza Bennani hamza@hamzabennani.com September 4, 2018 Logistics Office hours: Tue/Thu, 2pm to 3pm. Office: 250 Geoff Wyvill. Acknowledgment:

More information

What s New in tvos #WWDC16. App Frameworks. Session 206. Hans Kim tvos Engineer

What s New in tvos #WWDC16. App Frameworks. Session 206. Hans Kim tvos Engineer App Frameworks #WWDC16 What s New in tvos Session 206 Hans Kim tvos Engineer 2016 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple. Welcome

More information

Stream iphone Sensor Data to Adafruit IO

Stream iphone Sensor Data to Adafruit IO Stream iphone Sensor Data to Adafruit IO Created by Trevor Beaton Last updated on 2019-01-22 04:07:41 PM UTC Guide Contents Guide Contents Overview In this learn guide we will: Before we start... Downloading

More information

Automatic Strong Passwords and Security Code AutoFill

Automatic Strong Passwords and Security Code AutoFill Session #WWDC18 Automatic Strong Passwords and Security Code AutoFill 204 Chelsea Pugh, ios Engineer Reza Abbasian, ios Engineer Harris Papadopoulos, ios Engineer 2018 Apple Inc. All rights reserved. Redistribution

More information

Introducing Swift Playgrounds

Introducing Swift Playgrounds Developer Tools #WWDC16 Introducing Swift Playgrounds Exploring with Swift on ipad Session 408 Matt Patenaude Playgrounds Engineer Maxwell Swadling Playgrounds Engineer Jonathan Penn Playgrounds Engineer

More information

Core Data Best Practices

Core Data Best Practices #WWDC18 Core Data Best Practices Session 224 Scott Perry, Engineer Nick Gillett, Engineer 2018 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission

More information

ios Application Development Lecture 2: Seminar and Unit 1

ios Application Development Lecture 2: Seminar and Unit 1 ios Application Development Lecture 2: Seminar and Unit 1 Dr. Simon Völker & Philipp Wacker Media Computing Group RWTH Aachen University Winter Semester 2017/2018 http://hci.rwth-aachen.de/ios Swift 18

More information

Cocoa Development Tips

Cocoa Development Tips Session App Frameworks #WWDC17 Cocoa Development Tips Twenty-nine things you may not know about Cocoa 236 Rachel Goldeen, Cocoa Engineer Vincent Hittson, Cocoa Engineer 2017 Apple Inc. All rights reserved.

More information

Advances in AVFoundation Playback

Advances in AVFoundation Playback Media #WWDC16 Advances in AVFoundation Playback Waiting, looping, switching, widening, optimizing Session 503 Sam Bushell Media Systems Architect 2016 Apple Inc. All rights reserved. Redistribution or

More information

CloudKit Tips And Tricks

CloudKit Tips And Tricks System Frameworks #WWDC15 CloudKit Tips And Tricks Session 715 Nihar Sharma CloudKit Engineer 2015 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission

More information

Advanced Scrollviews and Touch Handling Techniques

Advanced Scrollviews and Touch Handling Techniques Frameworks #WWDC14 Advanced Scrollviews and Touch Handling Techniques Session 235 Josh Shaffer ios Apps and Frameworks Engineer Eliza Block ios Apps and Frameworks Engineer 2014 Apple Inc. All rights reserved.

More information

Discovering WKWebView

Discovering WKWebView Discovering WKWebView Designed to replace UIWebView on ios and WebView on macos. Both ios and macos have the same API Harder to use than UIWebView Multi-process Architecture Multi-process Architecture

More information

Getting the Most out of Playgrounds in Xcode

Getting the Most out of Playgrounds in Xcode #WWDC18 Getting the Most out of Playgrounds in Xcode Session 402 Tibet Rooney-Rabdau, Xcode Engineer Alex Brown, Core OS Engineer TJ Usiyan, Xcode Engineer 2018 Apple Inc. All rights reserved. Redistribution

More information

Optimizing Swift Performance Session 409

Optimizing Swift Performance Session 409 Developer Tools #WWDC15 Optimizing Swift Performance Session 409 Nadav Rotem Manager, Swift Performance Team Michael Gottesman Engineer, Swift Performance Team Joe Grzywacz Engineer, Performance Tools

More information

What s New in SpriteKit

What s New in SpriteKit Graphics and Games #WWDC16 What s New in SpriteKit Session 610 Ross Dexter Games Technologies Engineer Clément Boissière Games Technologies Engineer 2016 Apple Inc. All rights reserved. Redistribution

More information

Localizing with Xcode 9

Localizing with Xcode 9 Session Developer Tools #WWDC17 Localizing with Xcode 9 401 Sara Radi, Software Engineer Aya Siblini, Software Engineer Chris Hanson, Software Engineer 2017 Apple Inc. All rights reserved. Redistribution

More information

What s New in Core Bluetooth

What s New in Core Bluetooth Session System Frameworks #WWDC17 What s New in Core Bluetooth 712 Craig Dooley, Bluetooth Engineer Duy Phan, Bluetooth Engineer 2017 Apple Inc. All rights reserved. Redistribution or public display not

More information

lecture 10 UI/UX and Programmatic Design cs : spring 2018

lecture 10 UI/UX and Programmatic Design cs : spring 2018 lecture 10 UI/UX and Programmatic Design cs198-001 : spring 2018 1 Announcements custom app progress form due before lab (~1 minute) will be released after lecture only 2 labs left (both very important)

More information

What s New in ARKit 2

What s New in ARKit 2 Session #WWDC18 What s New in ARKit 2 602 Arsalan Malik, ARKit Engineer Reinhard Klapfer, ARKit Engineer 2018 Apple Inc. All rights reserved. Redistribution or public display not permitted without written

More information

Modern User Interaction on ios

Modern User Interaction on ios App Frameworks #WWDC17 Modern User Interaction on ios Mastering the UIKit UIGesture System Session 219 Dominik Wagner, UIKit Engineer Michael Turner, UIKit Engineer Glen Low, UIKit Engineer 2017 Apple

More information

Multitasking Support on the ios Platform

Multitasking Support on the ios Platform Multitasking Support on the ios Platform Priya Rajagopal Invicara (www.invicara.com) @rajagp Multitasking on ios? Multitasking allows apps to perform certain tasks in the background while you're using

More information

Touch Bar Fundamentals

Touch Bar Fundamentals Session App Frameworks #WWDC17 Touch Bar Fundamentals 211 Chris Dreessen John Tegtmeyer 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from

More information

Finding Bugs Using Xcode Runtime Tools

Finding Bugs Using Xcode Runtime Tools Session Developer Tools #WWDC17 Finding Bugs Using Xcode Runtime Tools 406 Kuba Mracek, Program Analysis Engineer Vedant Kumar, Compiler Engineer 2017 Apple Inc. All rights reserved. Redistribution or

More information

What s New in TVMLKit

What s New in TVMLKit #WWDC18 What s New in TVMLKit Session 238 Jeremy Foo, tvos Engineering 2018 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple. Web Inspector

More information

Swift API Design Guidelines

Swift API Design Guidelines Developer Tools #WWDC16 Swift API Design Guidelines The Grand Renaming Session 403 Doug Gregor Swift Engineer Michael Ilseman Swift Engineer 2016 Apple Inc. All rights reserved. Redistribution or public

More information

CS ios. Extensions, Protocols, and Generics

CS ios. Extensions, Protocols, and Generics CS4962 - ios Extensions, Protocols, and Generics Package Management Application level package managers CocoaPods Carthage SPM (Swift Package Manager) CocoaPods Centralized, searchable repository Automatically

More information

Swift. Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder

Swift. Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder Swift Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder Mobile Application Development in ios 1 Why Swift Recommended for all ios, macos, watchos,

More information

Mobile Development - Lab 2

Mobile Development - Lab 2 Mobile Development - Lab 2 Objectives Illustrate the delegation mechanism through examples Use a simple Web service Show how to simply make a hybrid app Display data with a grid layout Delegation pattern

More information

ios Configuration and APIs for Kiosk and Assessment Apps

ios Configuration and APIs for Kiosk and Assessment Apps Session Systems Framework #WWDC17 ios Configuration and APIs for Kiosk and Assessment Apps 716 Steve Hayman, Consulting Engineer 2017 Apple Inc. All rights reserved. Redistribution or public display not

More information

New Ways to Work with Workouts

New Ways to Work with Workouts Session #WWDC18 New Ways to Work with Workouts 707 Niharika Bedekar, Fitness Software Engineer Karim Benhmida, Health Software Engineer 2018 Apple Inc. All rights reserved. Redistribution or public display

More information

lecture 6 Closures, Networking, CocoaPods

lecture 6 Closures, Networking, CocoaPods lecture 6 Closures, Networking, CocoaPods cs198-001 : spring 2018 announcements no new lab this week - continuation of Pokedex lab + custom app workday (attendance still required) Pokedex due Wednesday

More information

What s New in Foundation for Swift Session 207

What s New in Foundation for Swift Session 207 App Frameworks #WWDC16 What s New in Foundation for Swift Session 207 Tony Parker Foundation, Apple Michael LeHew Foundation, Apple 2016 Apple Inc. All rights reserved. Redistribution or public display

More information

Getting to Know Swift Package Manager

Getting to Know Swift Package Manager #WWDC18 Getting to Know Swift Package Manager Session 411 Rick Ballard, SwiftPM Release Manager Boris Buegling, Developer Tools Engineer 2018 Apple Inc. All rights reserved. Redistribution or public display

More information

App. Chapter 19 App. App (ViewController) App. Single View Application Single View Application View. (View Controller)

App. Chapter 19 App. App (ViewController) App. Single View Application Single View Application View. (View Controller) Chapter 19 App App (ViewController) App 19.1 App App Single View Application Single View Application View Controller View Controller Label Button Button (View Controller) 2 View Controller Utility Area

More information

Introducing MusicKit. Media #WWDC17. Tim Parthemore, MusicKit Services Joel Lopes Da Silva, ios Music

Introducing MusicKit. Media #WWDC17. Tim Parthemore, MusicKit Services Joel Lopes Da Silva, ios Music Session Media #WWDC17 Introducing MusicKit 502 Tim Parthemore, MusicKit Services Joel Lopes Da Silva, ios Music 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted without

More information

Leveraging Touch Input on ios

Leveraging Touch Input on ios App Frameworks #WWDC16 Leveraging Touch Input on ios And getting the most out of Apple Pencil Session 220 Dominik Wagner UIKit Engineer 2016 Apple Inc. All rights reserved. Redistribution or public display

More information

What s New in NSCollectionView Session 225

What s New in NSCollectionView Session 225 App Frameworks #WWDC15 What s New in NSCollectionView Session 225 Troy Stephens Application Frameworks Engineer 2015 Apple Inc. All rights reserved. Redistribution or public display not permitted without

More information

Advanced Debugging and the Address Sanitizer

Advanced Debugging and the Address Sanitizer Developer Tools #WWDC15 Advanced Debugging and the Address Sanitizer Finding your undocumented features Session 413 Mike Swingler Xcode UI Infrastructure Anna Zaks LLVM Program Analysis 2015 Apple Inc.

More information

What s New in Energy Debugging

What s New in Energy Debugging #WWDC18 What s New in Energy Debugging Phillip Azar, Apple/Battery Life David Choi, Apple/Battery Life 2018 Apple Inc. All rights reserved. Redistribution or public display not permitted without written

More information

JavaScript for Automation

JavaScript for Automation Services #WWDC14 JavaScript for Automation Session 306 Sal Soghoian Product Manger Automation Technologies 2014 Apple Inc. All rights reserved. Redistribution or public display not permitted without written

More information

Improving your Existing Apps with Swift

Improving your Existing Apps with Swift Developer Tools #WWDC15 Improving your Existing Apps with Swift Getting Swifty with It Session 403 Woody L. in the Sea of Swift 2015 Apple Inc. All rights reserved. Redistribution or public display not

More information

What s New in LLDB. Debug your way to fame and glory #WWDC15. Developer Tools. Session 402

What s New in LLDB. Debug your way to fame and glory #WWDC15. Developer Tools. Session 402 Developer Tools #WWDC15 What s New in LLDB Debug your way to fame and glory Session 402 Kate Stone Software Behavioralist Sean Callanan Master of Expressions Enrico Granata Data Wizard 2015 Apple Inc.

More information

Introducing the Photos Frameworks

Introducing the Photos Frameworks Media #WWDC14 Introducing the Photos Frameworks Session 511 Adam Swift ios Photos Frameworks 2014 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission

More information

What s New in tvos 12

What s New in tvos 12 #WWDC18 What s New in tvos 12 Session 208 Hans Kim, tvos Engineering 2018 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple. Agenda Agenda

More information

What s New in Audio. Media #WWDC17. Akshatha Nagesh, AudioEngine-eer Béla Balázs, Audio Artisan Torrey Holbrook Walker, Audio/MIDI Black Ops

What s New in Audio. Media #WWDC17. Akshatha Nagesh, AudioEngine-eer Béla Balázs, Audio Artisan Torrey Holbrook Walker, Audio/MIDI Black Ops Session Media #WWDC17 What s New in Audio 501 Akshatha Nagesh, AudioEngine-eer Béla Balázs, Audio Artisan Torrey Holbrook Walker, Audio/MIDI Black Ops 2017 Apple Inc. All rights reserved. Redistribution

More information

Thread Sanitizer and Static Analysis

Thread Sanitizer and Static Analysis Developer Tools #WWDC16 Thread Sanitizer and Static Analysis Help with finding bugs in your code Session 412 Anna Zaks Manager, Program Analysis Team Devin Coughlin Engineer, Program Analysis Team 2016

More information

Introducing the Modern WebKit API

Introducing the Modern WebKit API Frameworks #WWDC14 Introducing the Modern WebKit API Session 206 Anders Carlsson Safari and WebKit Engineer 2014 Apple Inc. All rights reserved. Redistribution or public display not permitted without written

More information

Xcode & Swift: Introduction

Xcode & Swift: Introduction Dr.-Ing. Thomas Springer M.Sc. Martin Weißbach Concept You need Apple Computer Xcode 8 (ios device) Hands on course to learn how to program ios 1/1/0 means 45min lecture, 45min seminar introducing concepts

More information

Getting Published in Apple News

Getting Published in Apple News Media #WWDC16 Getting Published in Apple News Session 502 Ryan Griggs Apple News 2016 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.

More information

Using Accelerate and simd

Using Accelerate and simd Session #WWDC18 Using Accelerate and simd 701 Matthew Badin, CoreOS, Vector and Numerics Luke Chang, CoreOS, Vector and Numerics 2018 Apple Inc. All rights reserved. Redistribution or public display not

More information

What s New in Swift #WWDC18. Ted Kremenek, Languages & Runtimes Manager Slava Pestov, Swift Compiler Engineer

What s New in Swift #WWDC18. Ted Kremenek, Languages & Runtimes Manager Slava Pestov, Swift Compiler Engineer Session #WWDC18 What s New in Swift 401 Ted Kremenek, Languages & Runtimes Manager Slava Pestov, Swift Compiler Engineer 2018 Apple Inc. All rights reserved. Redistribution or public display not permitted

More information

ITP 342 Mobile App Dev. Animation

ITP 342 Mobile App Dev. Animation ITP 342 Mobile App Dev Animation Views Views are the fundamental building blocks of your app's user interface, and the UIView class defines the behaviors that are common to all views. Responsibilities

More information

Accessibility on ios. Developing for everyone. Frameworks #WWDC14. Session 210 Clare Kasemset ios Accessibility

Accessibility on ios. Developing for everyone. Frameworks #WWDC14. Session 210 Clare Kasemset ios Accessibility Frameworks #WWDC14 Accessibility on ios Developing for everyone Session 210 Clare Kasemset ios Accessibility 2014 Apple Inc. All rights reserved. Redistribution or public display not permitted without

More information

Learn to make watchosle

Learn to make watchosle HACKING WITH SWIFT COMPLETE TUTORIAL COURSE Learn to make watchosle P apps with real-worldam S Swift projects REEPaul Hudson F Project 1 NoteDictate 2 www.hackingwithswift.com Setting up In this project

More information

UI Design and Storyboarding

UI Design and Storyboarding UI Design and Storyboarding Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder Mobile Application Development in ios 1 Outline Model-View-Controller

More information