Skip to content

stomt/stomt-swift-sdk

Repository files navigation

Stomt Swift SDK

Stomt Logo

platforms-badge Build Status

Our SDK provides you with the tools for an easy and transparent integration of STOMT in your apps. This repository provides you with a target for all the Apple devices we are currently supporting.

Requirements

  • Swift 4
  • iOS 10+

Installation

Carthage

Carthage is "A simple, decentralized dependency manager for Cocoa"

  • Create a 'Cartfile' in your project root directory
  • Copy the following in the Cartfile: github "stomt/stomt-swift-sdk" ~> 0.1
  • Run carthage update from the project root directory to fetch and build the SDK

At this point Carthage will have built the SDK and produced the .framework file to include in your project. Due to the App Store submission bug, you should follow the installation instructions available in the Carthage repository.

Cocoapods

You can install Cocoapods with the command:

gem install cocoapods

To integrate the SDK using Cocoapods you have to create a Podfile with the following content:

platform :ios, '10.0'
target '<Your Target Name>' do
pod 'StomtSDK', '~> 0.1'
end

Finally, run

pod install

Manually

If you prefer not to use dependency managers you can install the framework manually.

  • If you are not using github for your project, execute git init, otherwise skip this step.
  • Add the SDK using git submodules git submodule add https://github.com/stomt/stomt-swift-sdk. A folder containing the SDK will be added to your project root folder.
  • Open the downloaded SDK folder and drag StomtSDK.xcodeproj inside and below your project icon in the Xcode navigator.
  • Click your project tab in the Xcode navigator and in General, scroll down and press + in Embedded Binaries to add Stomt.framework for the required platform.
  • Build the framework from the target drop-down.
  • Import following the instructions in the Usage section.

Widgets

A Widget consists of an instance of SFSafariViewController that gets presented by one of your ViewControllers. Widgets are the easiest way to incorporate stomt creation and feed retrieval functionalities in your app.

Setup

To use the widgets you must acquire an applicationID from the "APPS" section of your project page (stomt.com) and set it in the AppDelegate.swift file as follows:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    Stomt.setAppID(appID: "APPLICATIONID")
    return true
}

Stomt Creation

The STOMT creation Widget can be invoked like this:

Stomt.creationWidget(fromViewController: self)

Feed Retrieval

The feed retrieval Widget can be invoked like this:

Stomt.feedWidget(fromViewController: self)

FAQ

Is there an example project?

Definitely! You can find it in the "Examples" folder in the repo.