Swiftpack.co - Package - ServiceStack/ServiceStack.Swift
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.

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.

ServiceStack's Add ServiceStack Reference feature lets iOS/macOS developers easily generate an native typed Swift API for your ServiceStack Services using the x dotnet command-line tool.

Simple command-line utils for ServiceStack

The x dotnet tool provides a simple command-line UX to easily Add and Update Swift ServiceStack References.

Prerequisites: Install .NET Core.

$ dotnet tool install --global x 

This will make the x dotnet tool available in your $PATH which can now be used from within a Terminal window at your Xcode project folder.

To use the latest JsonServiceClient you'll need to add a reference to ServiceStack Swift library using your preferred package manager:

Xcode

From Xcode 12 the Swift Package Manager is built into Xcode.

Go to File > Swift Packages > Add Package Dependency:

Add a reference to the ServiceStack.Swift GitHub repo:

https://github.com/ServiceStack/ServiceStack.Swift

After adding the dependency both ServiceStack.Swift and its PromiseKit dependency will be added to your project:

CocoaPods

In your Podfile:

use_frameworks!

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

Carthage

github "ServiceStack/ServiceStack.Swift" ~> 1.1

SwiftPM

dependencies: [
    .package(url: "https://github.com/ServiceStack/ServiceStack.Swift.git", from: "1.0.0"),
],

Add a new ServiceStack Reference

To Add a new ServiceStack Reference, call x swift with the Base URL to a remote ServiceStack instance:

x swift {BaseUrl}
x swift {BaseUrl} {FileName}

Where if no FileName is provided, it's inferred from the host name of the remote URL, e.g:

x swift http://techstacks.io

Downloads the Typed Swift DTOs for techstacks.io and saves them to dtos.swift.

Alternatively you can have it saved to a different FileName with:

x swift http://techstacks.io TechStacks

Which instead saves the DTOs to TechStacks.dtos.swift.

x swift also downloads ServiceStack's Swift Client and saves it to JsonServiceClient.swift which together with the Server DTOs contains all the dependencies required to consume Typed Web Services in Swift.

Update an existing ServiceStack Reference

The easiest way to update all your Swift Server DTOs is to just call x swift without any arguments:

x swift

This will go through and update all your *.dtos.swift Service References.

To Update a specific ServiceStack Reference, call x swift with the Filename:

x swift {FileName.dtos.swift}

As an example, you can Update the Server DTOs added in the previous command with:

x swift TechStacks.dtos.swift

Which also includes any Customization Options that were manually added.

Optional DTO Customizations

Refer to Swift Add ServiceStack Reference docs for info on additional customizations available.

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

Github

link
Stars: 11

Dependencies

Releases

1.1.4 - 2020-10-07T22:30:13

1.1.3 - 2020-10-07T22:00:55

1.1.2 - 2020-08-29T07:33:04

v1.1.1 - 2019-02-19T17:40:58

1.1.0 - 2018-09-25T15:44:37

1.0.2 - 2018-09-25T15:39:32

1.0.1 - 2018-04-27T17:43:35

1.0.0 - 2018-04-27T17:13:16