SlideShare a Scribd company logo
1 of 21
Download to read offline
June 1, 2016
Open-Source Swift: Up and Running
Swift<Austin>() -> [Meetup][0]
Slides will be posted
No need to try to write everything down.
I’ll post a link to the Meetup.com comments
for this meeting.
Please, STOP me at
your convenience
Swift is new
It is changing very quickly
We’re all learning this together
Please share your experience with us
Assumptions
✤ You want to be able to Compile/Run/Test/Learn “Pure” Swift
✤ That is: Swift without the closed-source Objective-C runtime (more on that later)
✤ You don’t want to have to build Swift and LLDB from scratch
✤ At least not at this meeting
✤ You aren’t running the Exact, Precise versions of Ubuntu (15.10 or 14.04) Apple Supports on
the machine in front of you
✤ (If you are, then the first part of the meeting won’t be necessary for you, please hang on
for a while.)
Prerequisites
✤ You need a specific version of Ubuntu (15.10 or 14.04)
✤ You need specific libraries installed
✤ You need specific executables installed
✤ And those might change at any (or every) snapshot
✤ … OR, of course, you can CHEAT (and probably should)
Containers all the way down…
✤ We’re going to talk through a couple of options:
✤ Docker
✤ Vagrant
✤ I’m sure there are others
Swift Roulette: Step Right Up & Pick aVersion
✤ Usually several versions to pick from on swift.org/download
✤ The current release version is there (but that’s OLD)
✤ Historically, we’ve gotten a new SNAPSHOT every couple of weeks or so
✤ But, we just got Swift 3.0 Preview 1, (YESTERDAY!!) so I don’t know how
that might affect the SNAPSHOT schedule
Swift Roulette: Step Right Up & Pick aVersion
✤ Tonight, I’m going to use the 3.0 preview 1
✤ And I’m going to do it via Docker/Vagrant
Docker
✤ Seems to be coming the de-facto standard (from what I can see)
✤ Has issues with development (especially debugging - more later)
✤ Easy to use for deployment
✤ (You can use "carlbrown/docker-swift:latest", as a base
✤ at least until the rest of the ecosystem catches up with the latest drop)
Installing Docker
Mac or Windows
https://www.docker.com/products/docker-toolbox
Docker commands
docker run -it -v `pwd`:/Project swiftaustin-docker-swift ls /Project
docker build -t "swiftaustin-docker-swift" .
Vagrant
✤ Free VM software
✤ Build from spec file
✤ I tend to use this for development/debugging, and then move to Docker for
deployment
InstallingVagrant
Mac or Windows
https://www.vagrantup.com/downloads.html
Vagrant commands
vagrant ssh
vagrant up
Options and such are specified in vagrantfile
vagrant stop
vagrant destroy
June 1st, 2016
“Hello,World”
Really simple program with Docker and Vagrant configs and instructions https://github.com/SwiftAustin/HelloWorld
Vagrant “Hello,World”
start with: git clone https://github.com/SwiftAustin/HelloWorld.git
then: cd HelloWorld
run: vagrant up
then: vagrant ssh
then: cd /Project && swift build && ./build/debug/Project
Docker “Hello,World”
start with: git clone https://github.com/SwiftAustin/HelloWorld.git
then: cd HelloWorld
run: docker build -t "swiftaustin-docker-swift" .
then:
docker run -v ${PWD}:/Project swiftaustin-docker-swift 
bash -c 
”cd /Project && swift build && .build/debug/Project"
✤ swift build command expects a particular directory structure:
✤ Package.swift
✤ Sources/
✤ main.swift
✤ Tests/
✤ LinuxMain.swift
Swift Package Manager:A Brief Introduction
Playing with the REPL
✤ from vagrant ssh
✤ swift
Welcome to Swift version 3.0-dev (LLVM 3863c393d9, Clang d03752fe45, Swift
e996f0c248). Type :help for assistance.
1>
REPL with Docker
✤ REPL (and debugger) require root access (to be able to attach to processes)
✤ If you forget, you’ll get:
✤ To type, you also need -it for interactive and tty
docker run -it --privileged=true -v ${PWD}:/Project docker-swift swift
error: failed to launch REPL process: process launch failed: 'A' packet returned an error
Differences from OS X
✤ No Objective-C runtime
✤ Many casts between object types just fail
✤ Many libraries that work on OS X explode on Linux (often at runtime)
✤ e.g. I can put an Int64 into a Dictionary, but passing to SwiftyJSON crashes
✤ Many parts of Foundation just aren’t there
✤ Embrace your inner NSUnimplemented()

More Related Content

What's hot

Jenkins and rails app - Le Dinh Vu
Jenkins and rails app - Le Dinh VuJenkins and rails app - Le Dinh Vu
Jenkins and rails app - Le Dinh Vu
Framgia Vietnam
 
T3DD13 - Automated deployment for TYPO3 CMS (Workshop)
T3DD13 - Automated deployment for TYPO3 CMS (Workshop)T3DD13 - Automated deployment for TYPO3 CMS (Workshop)
T3DD13 - Automated deployment for TYPO3 CMS (Workshop)
Tobias Liebig
 
Openshift: Deployments for the rest of us
Openshift: Deployments for the rest of usOpenshift: Deployments for the rest of us
Openshift: Deployments for the rest of us
Anurag Patel
 

What's hot (20)

Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !
Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !
Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !
 
TYPO3 Surf Introduction
TYPO3 Surf IntroductionTYPO3 Surf Introduction
TYPO3 Surf Introduction
 
Jenkins and rails app - Le Dinh Vu
Jenkins and rails app - Le Dinh VuJenkins and rails app - Le Dinh Vu
Jenkins and rails app - Le Dinh Vu
 
Use groovy & grails in your spring boot projects
Use groovy & grails in your spring boot projectsUse groovy & grails in your spring boot projects
Use groovy & grails in your spring boot projects
 
T3DD13 - Automated deployment for TYPO3 CMS (Workshop)
T3DD13 - Automated deployment for TYPO3 CMS (Workshop)T3DD13 - Automated deployment for TYPO3 CMS (Workshop)
T3DD13 - Automated deployment for TYPO3 CMS (Workshop)
 
Openshift: Deployments for the rest of us
Openshift: Deployments for the rest of usOpenshift: Deployments for the rest of us
Openshift: Deployments for the rest of us
 
Bgoug 2019.11 test your pl sql - not your patience
Bgoug 2019.11   test your pl sql - not your patienceBgoug 2019.11   test your pl sql - not your patience
Bgoug 2019.11 test your pl sql - not your patience
 
Dead-Simple Async Control Flow with Coroutines
Dead-Simple Async Control Flow with CoroutinesDead-Simple Async Control Flow with Coroutines
Dead-Simple Async Control Flow with Coroutines
 
5 Simple Tips for Troubleshooting Your Kubernetes Pods
5 Simple Tips for Troubleshooting Your Kubernetes Pods5 Simple Tips for Troubleshooting Your Kubernetes Pods
5 Simple Tips for Troubleshooting Your Kubernetes Pods
 
Golang workshop
Golang workshopGolang workshop
Golang workshop
 
Node.js + influx + grafana
Node.js + influx + grafanaNode.js + influx + grafana
Node.js + influx + grafana
 
Git hooks
Git hooksGit hooks
Git hooks
 
Frida Android run time hooking - Bhargav Gajera & Vitthal Shinde
Frida  Android run time hooking - Bhargav Gajera & Vitthal ShindeFrida  Android run time hooking - Bhargav Gajera & Vitthal Shinde
Frida Android run time hooking - Bhargav Gajera & Vitthal Shinde
 
Skaffold - faster development on K8S
Skaffold - faster development on K8SSkaffold - faster development on K8S
Skaffold - faster development on K8S
 
OpenShift for developers in action! - jbcnconf19
OpenShift for developers in action! - jbcnconf19OpenShift for developers in action! - jbcnconf19
OpenShift for developers in action! - jbcnconf19
 
Shift Remote: Mobile - Devops-ify your life with Github Actions - Nicola Cort...
Shift Remote: Mobile - Devops-ify your life with Github Actions - Nicola Cort...Shift Remote: Mobile - Devops-ify your life with Github Actions - Nicola Cort...
Shift Remote: Mobile - Devops-ify your life with Github Actions - Nicola Cort...
 
Git hooks for front end developers
Git hooks for front end developersGit hooks for front end developers
Git hooks for front end developers
 
Enjoy privacy on Gitlab
Enjoy privacy on GitlabEnjoy privacy on Gitlab
Enjoy privacy on Gitlab
 
Git hooks
Git hooksGit hooks
Git hooks
 
Ci system part ii
Ci system part iiCi system part ii
Ci system part ii
 

Similar to Open Source Swift: Up and Running

Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx PluginGr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Yasuharu Nakano
 
Testing Salt States (part 1)
Testing Salt States (part 1)Testing Salt States (part 1)
Testing Salt States (part 1)
jasondenning
 
How to start using Scala
How to start using ScalaHow to start using Scala
How to start using Scala
Ngoc Dao
 

Similar to Open Source Swift: Up and Running (20)

Ci For The Web 2.0 Guy Or Gal
Ci For The Web 2.0 Guy Or GalCi For The Web 2.0 Guy Or Gal
Ci For The Web 2.0 Guy Or Gal
 
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx PluginGr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
 
Vagrant and puppet: Deployment made easy
Vagrant and puppet: Deployment made easyVagrant and puppet: Deployment made easy
Vagrant and puppet: Deployment made easy
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 
Testing Salt States (part 1)
Testing Salt States (part 1)Testing Salt States (part 1)
Testing Salt States (part 1)
 
Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3
 
#vBrownBag OpenStack - Review & Kickoff for Phase 2
#vBrownBag OpenStack - Review & Kickoff for Phase 2#vBrownBag OpenStack - Review & Kickoff for Phase 2
#vBrownBag OpenStack - Review & Kickoff for Phase 2
 
Dependent things dependency management for apple sw - slideshare
Dependent things   dependency management for apple sw - slideshareDependent things   dependency management for apple sw - slideshare
Dependent things dependency management for apple sw - slideshare
 
How to start using Scala
How to start using ScalaHow to start using Scala
How to start using Scala
 
Swift server-side-let swift2016
Swift server-side-let swift2016Swift server-side-let swift2016
Swift server-side-let swift2016
 
The development environment
The development environmentThe development environment
The development environment
 
Instruction: dev environment
Instruction: dev environmentInstruction: dev environment
Instruction: dev environment
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with server
 
Subversionn Introduction at SuperMondays 2009-09-01
Subversionn Introduction at SuperMondays 2009-09-01Subversionn Introduction at SuperMondays 2009-09-01
Subversionn Introduction at SuperMondays 2009-09-01
 
Open shift
Open shiftOpen shift
Open shift
 
A glance at the Rust SWC
A glance at the Rust SWCA glance at the Rust SWC
A glance at the Rust SWC
 
Cape Cod Web Technology Meetup - 3
Cape Cod Web Technology Meetup - 3Cape Cod Web Technology Meetup - 3
Cape Cod Web Technology Meetup - 3
 
Try! Swift Tokyo2017
Try! Swift Tokyo2017Try! Swift Tokyo2017
Try! Swift Tokyo2017
 
Sbt, idea and eclipse
Sbt, idea and eclipseSbt, idea and eclipse
Sbt, idea and eclipse
 
Os dev tool box
Os dev tool boxOs dev tool box
Os dev tool box
 

More from Carl Brown

Cocoa coders 141113-watch
Cocoa coders 141113-watchCocoa coders 141113-watch
Cocoa coders 141113-watch
Carl Brown
 

More from Carl Brown (20)

GDPR, User Data, Privacy, and Your Apps
GDPR, User Data, Privacy, and Your AppsGDPR, User Data, Privacy, and Your Apps
GDPR, User Data, Privacy, and Your Apps
 
New in iOS 11.3b4 and Xcode 9.3b4
New in iOS 11.3b4 and Xcode 9.3b4New in iOS 11.3b4 and Xcode 9.3b4
New in iOS 11.3b4 and Xcode 9.3b4
 
Managing Memory in Swift (Yes, that's a thing)
Managing Memory in Swift (Yes, that's a thing)Managing Memory in Swift (Yes, that's a thing)
Managing Memory in Swift (Yes, that's a thing)
 
Better Swift from the Foundation up #tryswiftnyc17 09-06
Better Swift from the Foundation up #tryswiftnyc17 09-06Better Swift from the Foundation up #tryswiftnyc17 09-06
Better Swift from the Foundation up #tryswiftnyc17 09-06
 
Generics, the Swift ABI and you
Generics, the Swift ABI and youGenerics, the Swift ABI and you
Generics, the Swift ABI and you
 
Swift GUI Development without Xcode
Swift GUI Development without XcodeSwift GUI Development without Xcode
Swift GUI Development without Xcode
 
what's new in iOS10 2016-06-23
what's new in iOS10 2016-06-23what's new in iOS10 2016-06-23
what's new in iOS10 2016-06-23
 
Parse migration CocoaCoders April 28th, 2016
Parse migration CocoaCoders April 28th, 2016Parse migration CocoaCoders April 28th, 2016
Parse migration CocoaCoders April 28th, 2016
 
Advanced, Composable Collection Views, From CocoaCoders meetup Austin Feb 12,...
Advanced, Composable Collection Views, From CocoaCoders meetup Austin Feb 12,...Advanced, Composable Collection Views, From CocoaCoders meetup Austin Feb 12,...
Advanced, Composable Collection Views, From CocoaCoders meetup Austin Feb 12,...
 
Gcd cc-150205
Gcd cc-150205Gcd cc-150205
Gcd cc-150205
 
Cocoa coders 141113-watch
Cocoa coders 141113-watchCocoa coders 141113-watch
Cocoa coders 141113-watch
 
iOS8 and the new App Store
iOS8 and the new App Store   iOS8 and the new App Store
iOS8 and the new App Store
 
Dark Art of Software Estimation 360iDev2014
Dark Art of Software Estimation 360iDev2014Dark Art of Software Estimation 360iDev2014
Dark Art of Software Estimation 360iDev2014
 
Intro to cloud kit Cocoader.org 24 July 2014
Intro to cloud kit   Cocoader.org 24 July 2014Intro to cloud kit   Cocoader.org 24 July 2014
Intro to cloud kit Cocoader.org 24 July 2014
 
Welcome to Swift (CocoaCoder 6/12/14)
Welcome to Swift (CocoaCoder 6/12/14)Welcome to Swift (CocoaCoder 6/12/14)
Welcome to Swift (CocoaCoder 6/12/14)
 
Writing Apps that Can See: Getting Data from CoreImage to Computer Vision - ...
Writing Apps that Can See: Getting Data from CoreImage to Computer  Vision - ...Writing Apps that Can See: Getting Data from CoreImage to Computer  Vision - ...
Writing Apps that Can See: Getting Data from CoreImage to Computer Vision - ...
 
Introduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsIntroduction to Git Commands and Concepts
Introduction to Git Commands and Concepts
 
REST/JSON/CoreData Example Code - A Tour
REST/JSON/CoreData Example Code - A TourREST/JSON/CoreData Example Code - A Tour
REST/JSON/CoreData Example Code - A Tour
 
360iDev iOS AntiPatterns
360iDev iOS AntiPatterns360iDev iOS AntiPatterns
360iDev iOS AntiPatterns
 
Chipmunk physics presentation
Chipmunk physics presentationChipmunk physics presentation
Chipmunk physics presentation
 

Recently uploaded

Recently uploaded (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Open Source Swift: Up and Running

  • 1. June 1, 2016 Open-Source Swift: Up and Running Swift<Austin>() -> [Meetup][0]
  • 2. Slides will be posted No need to try to write everything down. I’ll post a link to the Meetup.com comments for this meeting.
  • 3. Please, STOP me at your convenience Swift is new It is changing very quickly We’re all learning this together Please share your experience with us
  • 4. Assumptions ✤ You want to be able to Compile/Run/Test/Learn “Pure” Swift ✤ That is: Swift without the closed-source Objective-C runtime (more on that later) ✤ You don’t want to have to build Swift and LLDB from scratch ✤ At least not at this meeting ✤ You aren’t running the Exact, Precise versions of Ubuntu (15.10 or 14.04) Apple Supports on the machine in front of you ✤ (If you are, then the first part of the meeting won’t be necessary for you, please hang on for a while.)
  • 5. Prerequisites ✤ You need a specific version of Ubuntu (15.10 or 14.04) ✤ You need specific libraries installed ✤ You need specific executables installed ✤ And those might change at any (or every) snapshot ✤ … OR, of course, you can CHEAT (and probably should)
  • 6. Containers all the way down… ✤ We’re going to talk through a couple of options: ✤ Docker ✤ Vagrant ✤ I’m sure there are others
  • 7. Swift Roulette: Step Right Up & Pick aVersion ✤ Usually several versions to pick from on swift.org/download ✤ The current release version is there (but that’s OLD) ✤ Historically, we’ve gotten a new SNAPSHOT every couple of weeks or so ✤ But, we just got Swift 3.0 Preview 1, (YESTERDAY!!) so I don’t know how that might affect the SNAPSHOT schedule
  • 8. Swift Roulette: Step Right Up & Pick aVersion ✤ Tonight, I’m going to use the 3.0 preview 1 ✤ And I’m going to do it via Docker/Vagrant
  • 9. Docker ✤ Seems to be coming the de-facto standard (from what I can see) ✤ Has issues with development (especially debugging - more later) ✤ Easy to use for deployment ✤ (You can use "carlbrown/docker-swift:latest", as a base ✤ at least until the rest of the ecosystem catches up with the latest drop)
  • 10. Installing Docker Mac or Windows https://www.docker.com/products/docker-toolbox
  • 11. Docker commands docker run -it -v `pwd`:/Project swiftaustin-docker-swift ls /Project docker build -t "swiftaustin-docker-swift" .
  • 12. Vagrant ✤ Free VM software ✤ Build from spec file ✤ I tend to use this for development/debugging, and then move to Docker for deployment
  • 14. Vagrant commands vagrant ssh vagrant up Options and such are specified in vagrantfile vagrant stop vagrant destroy
  • 15. June 1st, 2016 “Hello,World” Really simple program with Docker and Vagrant configs and instructions https://github.com/SwiftAustin/HelloWorld
  • 16. Vagrant “Hello,World” start with: git clone https://github.com/SwiftAustin/HelloWorld.git then: cd HelloWorld run: vagrant up then: vagrant ssh then: cd /Project && swift build && ./build/debug/Project
  • 17. Docker “Hello,World” start with: git clone https://github.com/SwiftAustin/HelloWorld.git then: cd HelloWorld run: docker build -t "swiftaustin-docker-swift" . then: docker run -v ${PWD}:/Project swiftaustin-docker-swift bash -c ”cd /Project && swift build && .build/debug/Project"
  • 18. ✤ swift build command expects a particular directory structure: ✤ Package.swift ✤ Sources/ ✤ main.swift ✤ Tests/ ✤ LinuxMain.swift Swift Package Manager:A Brief Introduction
  • 19. Playing with the REPL ✤ from vagrant ssh ✤ swift Welcome to Swift version 3.0-dev (LLVM 3863c393d9, Clang d03752fe45, Swift e996f0c248). Type :help for assistance. 1>
  • 20. REPL with Docker ✤ REPL (and debugger) require root access (to be able to attach to processes) ✤ If you forget, you’ll get: ✤ To type, you also need -it for interactive and tty docker run -it --privileged=true -v ${PWD}:/Project docker-swift swift error: failed to launch REPL process: process launch failed: 'A' packet returned an error
  • 21. Differences from OS X ✤ No Objective-C runtime ✤ Many casts between object types just fail ✤ Many libraries that work on OS X explode on Linux (often at runtime) ✤ e.g. I can put an Int64 into a Dictionary, but passing to SwiftyJSON crashes ✤ Many parts of Foundation just aren’t there ✤ Embrace your inner NSUnimplemented()