If you have different versions of Xcode locally installed, you need to switch to Xcode 8.x. to use Swift 3.1
rm -rf ~/Library/Developer/Xcode/DerivedData/
sudo xcode-select -switch ~/PATH_TO_YOUR_XCODE_8/Xcode.app/1 . Ensure that you have Node.js 8.0 installed:
node —v
2 . Install Yeoman:
npm install -g yo
3 . Install Swift Server Generator:
npm install -g generator-swiftserver
pod --version
yo swiftserver
yo swiftserver:model
Create a model called "Creature" with the following attributes.
| attribute | type |
|---|---|
| name | string |
| picture | string |
open server_app.xcodeproj
- Target settings : Run -> select 'server_app'.
- Start the server locally.
- http://localhost:8080/
- http://localhost:8080/swiftmetrics-dash/
- http://localhost:8080/explorer/
(not mandatory)
- Unzip
server_app_iOS_SDK.zipand put it in the iOS app directory. - Init cocoapod.
pod init
- Edit the podfile :
# Uncomment the next line to define a global platform for your project# platform :ios, '9.0'
target 'theServerSideSwift' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for theServerSideSwift
pod 'Server_app_iOS_SDK', :path => "Server_app_iOS_SDK"
end
- install Pods :
pod install
heroku create --buildpack https://github.com/kylef/heroku-buildpack-swift.git
Dont forget to create a Procfile in the root directory of the server_app.
echo "web: server_app" > Procfile
Then, plug your server_app directory to the heroku remote and push to deploy.
git init
heroku git:remote -a john-do-4242
git add .
git commit -am "deploy"
git push heroku master
heroku open
Thanks ianpartridge and seabaylea
