Follow @ServiceStack or join the Google+ Community for updates, or StackOverflow or the Customer Forums for support.
See Swift Add ServiceStack Reference for an overview of the Swift Support in ServiceStack.
Requires Xcode 9+ / Swift 4
In your Podfile:
use_frameworks!
# Pods for Project
pod "ServiceStack", '~> 1.0'
github "ServiceStack/ServiceStack.Swift" ~> 1.0
package.dependencies.append(
.Package(url: "ServiceStack/ServiceStack.Swift", majorVersion: 1)
)
ServiceStack's Add ServiceStack Reference feature lets iOS/OSX developers generate an native typed Swift 2.0 API for your ServiceStack Services directly from within XCode using the new ServiceStack XCode Plugin - providing a simpler, cleaner and more versatile alternative to WCF's Add Service Reference feature that reduces the burden and effort required for consuming ServiceStack Services whilst benefiting from Swift's strong-typing feedback:
The ServiceStack XCode Plugin can be installed by dragging it to the XCode Plugins directory:
Once installed, developers can easily add a reference to a remote ServiceStack instance and update its typed DTO's using the new Menu options in XCode's Main Menu:
Use the Add ServiceStack Reference Menu option to bring up the Add Reference XCode UI Sheet, which just like the Popup Window in VS.NET just needs the Url for your remote ServiceStack instance and the name of the file the generated Swift DTO's should be saved to:
After clicking Add Reference, 2 files will be added to your XCode project yielding an instant typed API:
JsonServiceClient.swift
- A Swift JSON ServiceClient with API's based on that of the .NET JsonServiceClient{FileName}.dtos.swift
- Your Services DTO Types converted in Swift
You can also customize how the Swift types are generated by uncommenting the desired option with the behavior you want, then click the Update ServiceStack Reference Main Menu item to fetch the latest DTO's with the updated options as seen below:
AutoQuery Viewer is a native iPad App that provides an automatic UI for browsing, inspecting and querying any publicly accessible ServiceStack AutoQuery Service from an iPad.
The TechStacks Native iOS App provides a fluid and responsive experience for browsing http://techstacks.io content on iPhones and iPad devices. It takes advantage of the ease-of-use and utility of ServiceStack's new support for Swift and XCode for quickly building services-rich iOS Apps. Get it now free on the AppStore!
TechStacks OSX Desktop App is built around 2 AutoQuery Services showing how much querying functionality AutoQuery Services provides for free and how easy they are to call with ServiceStack's new support for Swift and XCode.