Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

Your Awesome Code Platforms Continuous Integration Releases Installation

Slide 3

Slide 3 text

SWIFT LIBRARY CREATING A

Slide 4

Slide 4 text

Example

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

import Foundation /// Sleeps for a random time interval public func rest() { let interval = NSTimeInterval(random() % 2) NSThread.sleepForTimeInterval(interval) }

Slide 7

Slide 7 text

import XCTest import Snorlax import Foundation class SnorlaxTests: XCTestCase { func testRest() { let expectation = expectationWithDescription("Resting") dispatch_async(dispatch_get_main_queue()) { rest() expectation.fulfill() } waitForExpectationsWithTimeout(5, handler: nil) } }

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

App Extensions Allow app extension API only

Slide 11

Slide 11 text

import Snorlax PRODUCT_MODULE_NAME

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

Testing

Slide 15

Slide 15 text

Xcode Betas Matrix Builds Managed CI Github Integration

Slide 16

Slide 16 text

# .travis.yml osx_image: xcode7.2 language: objective-c script: ./test

Slide 17

Slide 17 text

#!/bin/bash # ./test script set -e # stop when a test fails xcodebuild test -scheme Snorlax-OSX -destination "platform=OS X" xcodebuild test -scheme Snorlax-iOS -destination "platform=iOS Simulator,name=iPhone 6,OS=9.2" xcodebuild test -scheme Snorlax-tvOS -destination "platform=tvOS Simulator,name=Apple TV 1080p,OS=9.1"

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

pod spec create Snorlax

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

carthage build —no-skip-current

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

// Package.swift import PackageDescription let package = Package( name: "Snorlax" )

Slide 26

Slide 26 text

Snorlax/ |- Package.swift |- Sources/ | |- Snorlax/ | | |- Snorlax.swift

Slide 27

Slide 27 text

Snorlax/ |- Package.swift |- Sources/ |- Tests/ | |- Snorlax/ | | |- SnorlaxTest.swift

Slide 28

Slide 28 text

Snorlax/ |- Package.swift |- Sources/ |- Tests/ | |- LinuxMain.swift | |- Snorlax/

Slide 29

Slide 29 text

LinuxMain.swift

Slide 30

Slide 30 text

// LinuxMain.swift import XCTest @testable import Snorlaxtest // This is the entry point for tests on Linux XCTMain([ SnorlaxTests(), ])

Slide 31

Slide 31 text

// ... SnorlaxTests.swift ... class SnorlaxTests: XCTestCase, XCTestCaseProvider { var allTests: [(String, () throws -> Void)] { return [("testRest", testRest)] } func testRest() { let start = NSDate() rest() let end = NSDate() let duration = end.timeIntervalSinceDate(start) XCTAssertGreaterThanOrEqual(duration, 0) XCTAssertLessThan(duration, 2) } }

Slide 32

Slide 32 text

// ... SnorlaxTests.swift ... class SnorlaxTests: XCTestCase, XCTestCaseProvider { var allTests: [(String, () throws -> Void)] { return [("testRest", testRest)] } func testRest() { let start = NSDate() rest() let end = NSDate() let duration = end.timeIntervalSinceDate(start) XCTAssertGreaterThanOrEqual(duration, 0) XCTAssertLessThan(duration, 2) } }

Slide 33

Slide 33 text

#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS) public protocol XCTestCaseProvider { var allTests: [(String, () throws -> Void)] { get } } #endif class SnorlaxTests: XCTestCase, XCTestCaseProvider { ... }

Slide 34

Slide 34 text

swift build swift test

Slide 35

Slide 35 text

DEVELOPMENT-SNAPSHOT-2016-03-01-a DEVELOPMENT-SNAPSHOT-2016-02-25-a DEVELOPMENT-SNAPSHOT-2016-02-08-a DEVELOPMENT-SNAPSHOT-2016-02-03-a

Slide 36

Slide 36 text

SwiftEnv github.com/kylef/swiftenv

Slide 37

Slide 37 text

swiftenv install DEVELOPMENT-SNAPSHOT-2016-03-01-a swiftenv local DEVELOPMENT-SNAPSHOT-2016-03-01-a

Slide 38

Slide 38 text

# .travis.yml osx_image: xcode7.2 language: generic matrix: include: - os: osx env: TYPE=xcode - os: osx env: TYPE=spm - os: linux dist: trusty sudo: required env: TYPE=spm # Install SwiftEnv install: if [[ "$TYPE" == "spm" ]]; then eval "$(curl -sL https://…)"; fi script: ./test $TYPE

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

Creating a Release

Slide 41

Slide 41 text

1.2.3 Major Minor Patch semver.org

Slide 42

Slide 42 text

TEXT CUTTING A RELEASE ▸ Update version in Podspec (commit and push it) ▸ Tag new version: git tag v0.1.2 ▸ Push tag: git push origin v0.1.2 ▸ Push podspec: pod trunk push Snorlax.podspec ▸ Create a release from a tag in Github ▸ Announce!

Slide 43

Slide 43 text

github.com/jeffh/Snorlax github.com/jeffh/SnorlaxSamples

Slide 44

Slide 44 text

JEFFHUI.NET @JEFFHUI THANKS!