/ServiceStack.Swift

Swift support used in ServiceStack

Primary LanguageSwiftOtherNOASSERTION

Follow @ServiceStack or join the Google+ Community for updates, or StackOverflow or the Customer Forums for support.

ServiceStack.Swift

See Swift Add ServiceStack Reference for an overview of the Swift Support in ServiceStack.

Install

Requires Xcode 9+ / Swift 4.2

CocoaPods

In your Podfile:

use_frameworks!

# Pods for Project
pod "ServiceStack", '~> 1.1'

Carthage

github "ServiceStack/ServiceStack.Swift" ~> 1.1

SwiftPM

package.dependencies.append(
    .Package(url: "ServiceStack/ServiceStack.Swift", majorVersion: 1)
)

Issues

Please submit issues to https://github.com/ServiceStack/Issues

ServiceStack Xcode Plugin

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:

Download ServiceStack Xcode Plugin

ServiceStackXCode.dmg download

The ServiceStack XCode Plugin can be installed by dragging it to the XCode Plugins directory:

ServiceStackXCode.dmg Installer

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:

Add ServiceStack Reference

XCode Add Reference

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:

XCode Add Reference Sheet

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

Update ServiceStack Reference

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:

XCode Update Reference

Swift Apps using ServiceStack.Swift

AutoQuery Viewer

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.

AutoQuery Viewer on AppStore

TechStacks iOS App

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 on AppStore

Features

TechStacks Cocoa OSX Desktop App

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.

TechStack Desktop Search Fields