Chiara Chiappini - Swift and the future of iOS app development

Preview:

Citation preview

Swift and the future of iOS

Chiara Chiappini @chiarachiappini

google.com/+chiarachiappini

Swift

@chiarachiappini

Jun 2014

June 2015

Some point this

year?

Swift announced at WWDC 2014

Swift 2 announced at WWDC 2015

Swift will be open source

4 key features of Swift

Modern

@chiarachiappini

4 key features of Swift

ModernEasy

@chiarachiappini

4 key features of Swift

ModernEasySafe

@chiarachiappini

4 key features of Swift

ModernEasySafeSmall

@chiarachiappini

Swift Playground

@chiarachiappini

Swift and Objective-C Swift let name ="Chiara"

print("Hello \(name)")

Objective-C NSString*str =@"Hello Chiara";

NSLog(@"%@", str)

@chiarachiappini

Xcode vs Appcode

@chiarachiappini

Dependency managementCocoapods vs Maven vs Gradle

@chiarachiappini

sudo gem install cocoapodspod init

edit PodFile (similar to editing pom.xml)pod install

@chiarachiappini

platform :ios, '8.0'use_frameworks!

target 'SwiftTalk' do pod 'Alamofire', '~> 3.1'end

target 'SwiftTalkTests' do pod 'Quick', '~> 0.6.0' pod 'Nimble', '2.0.0-rc.3'end

Protocol vs Interface

@chiarachiappini

protocol Sweet { var sugarQuantity: Int { get }}

class BlackChocolate: Sweet { var sugarQuantity: Int = 10}

@chiarachiappini

Unit Tests

@chiarachiappini

XCTest vs JUnit

testing framework integrated with XCode

@chiarachiappini

XCTest exampleclass MyTestsXCTests: XCTestCase{ let myNumbers = [1,2,3] func testNumbersWithXCTest() { XCTAssertEqual(1 + 1, 2, "expected one plus one to equal two") for number in myNumbers{ XCTAssertLessThan(number, 4) } }}

@chiarachiappini

Use @testableimport XCTest@testable import CodemotionExamples

class CodemotionExamplesTests: XCTestCase { func testBlackChocolateHasSugar() { let blackChocolate = BlackChocolate() XCTAssertEqual(blackChocolate.sugarQuantity, 10, "Expected sugar quantity is 10") } }

@chiarachiappini

Quick and Nimble

Quick:behaviour driven testing frameworkNimble: fluent assertions

https://github.com/Quick/Nimble

@chiarachiappini

Nimble

func testNumbersWithNimble() { expect(1+1).to(equal(2)) expect([1,2,3]).to(allPass(beLessThan(4))) }

@chiarachiappini

func testStringWithNimble() { let myString = "Hello!" expect(myString).to(equal("Hello!"))

expect(myString)==("Hello!") expect(myString).to(beginWith("Hel")) }

@chiarachiappini

Quickclass MyTestsQuick: QuickSpec { override func spec() { describe("Testing numbers") { context("when adding 1 and 2"){ it("results as 3") { expect(1+2).to(equal(3)) } } }

@chiarachiappini

Testing and CI

@chiarachiappini

Continuous Integration

early feedback

@chiarachiappini

Continuous Integration

early feedbackteam peace of mind and alerting

@chiarachiappini

Continuous Integration

early feedbackteam peace of mind and alerting

standardized build

@chiarachiappini

Continuous Integration

early feedbackteam peace of mind and alerting

standardized buildrecord of results

@chiarachiappini

Continuous Integration

early feedbackteam peace of mind and alerting

standardized buildrecord of results

support release process

@chiarachiappini

Continuous Integration

early feedbackteam peace of mind and alerting

standardized buildrecord of results

support release processfirst step to continuous deployment

@chiarachiappini

CI for mobile

maturityemulators and real devices

@chiarachiappini

CI for iOS

Xcode server

@chiarachiappini

CI for iOS

Xcode serverJenkins

@chiarachiappini

CI for iOS

Xcode serverJenkins

...

@chiarachiappini

Xcode service and bots

Xcode service integrated in Xcode

@chiarachiappini

Xcode service and bots

Xcode service integrated in Xcodemanage bots from Xcode

@chiarachiappini

Jenkins

Xcode plugin or Xcode tool

@chiarachiappini

Jenkins Jobs

build and unit test the app

@chiarachiappini

Jenkins Jobs

build and unit test the apprun functional tests

@chiarachiappini

Jenkins Jobs

build and unit test the apprun acceptance tests

build application archive (ipa)

@chiarachiappini

Jenkins Jobs

build and unit test the apprun acceptance tests

build application archive (ipa)tag and archive the ipa

@chiarachiappini

Jenkins Jobs

build and unit test the apprun acceptance tests

build application archive (ipa)tag and archive the ipa

send to TestFlight@chiarachiappini

What we learntWhat is Swift

What we learntWhat is Swift

How to practice

What we learntWhat is Swift

How to practice Some Java-Swift language equivalences

What we learntWhat is Swift

How to practice Some Java-Swift language equivalences

Tools

What we learntWhat is Swift

How to practice Some Java-Swift language equivalences

ToolsTesting and CI

Go for Swift!

Recommended