Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomatoes-app/tomatoes-swift-sdk
Swift SDK of Tomatoes - Pomodoro Technique® online time tracker
https://github.com/tomatoes-app/tomatoes-swift-sdk
ios iphone macos pomodoro sdk swift
Last synced: about 1 month ago
JSON representation
Swift SDK of Tomatoes - Pomodoro Technique® online time tracker
- Host: GitHub
- URL: https://github.com/tomatoes-app/tomatoes-swift-sdk
- Owner: tomatoes-app
- License: apache-2.0
- Created: 2017-01-28T15:34:53.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-05T20:54:41.000Z (almost 8 years ago)
- Last Synced: 2024-03-26T02:26:03.875Z (9 months ago)
- Topics: ios, iphone, macos, pomodoro, sdk, swift
- Language: Swift
- Homepage: http://www.tomato.es
- Size: 725 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tomatoes Swift SDK
[![Build Status](https://travis-ci.org/tomatoes-app/tomatoes-swift-sdk.svg?branch=master)](https://travis-ci.org/tomatoes-app/tomatoes-swift-sdk)The Tomatoes Swift SDK allows developers to quickly integrate Tomatoes services into their Swift applications.
See [API reference](http://www.tomato.es/pages/api_reference) for more details.## Requirements
- iOS 9.0+ / macOS 10.11+
- Xcode 8.1+
- Swift 3.0+## Installation
### CarthageYou can install [Carthage](https://github.com/Carthage/Carthage) with [Homebrew](http://brew.sh/) using the following command:
```bash
$ brew update
$ brew install carthage
```To integrate Tomatoes Swift SDK into your Xcode project using Carthage, specify it in your `Cartfile`:
```ogdl
github "tomatoes-app/tomatoes-swift-sdk" ~> 0.2.1
```Run `carthage update` to build the framework and drag the built `Tomatoes.framework` into your Xcode project.
### Swift Package Manager
Add the following code to your `Package.swift` file and run `swift build`.
```Swift
import PackageDescriptionlet package = Package(
name: "tomatoes-swift-sdk",
dependencies: [
.Package(url: "https://github.com/tomatoes-app/tomatoes-swift-sdk.git", Version(0,2,1))
])
```
### App Transport SecurityApp Transport Security was introduced with iOS 9 to enforce secure Internet connections, but Tomatoes doesn't support HTTPS yet. Allow insecure connections to Tomatoes by adding the following exception to your application's `Info.plist` file.
```xml
NSAppTransportSecurity
NSExceptionDomains
www.tomato.es
NSExceptionAllowsInsecureHTTPLoads
NSIncludesSubdomains
NSTemporaryExceptionMinimumTLSVersion
TLSv1.1
```## Usage
Review the iOS [sample application](https://github.com/tomatoes-app/tomatoes-ios)### Create a Tomatoes session
To establish a new Tomatoes session you'll need to implement GitHub auth and retrieve a GitHub user access token, see [GitHub doc](https://developer.github.com/v3/oauth_authorizations/). Leave the default scope.
Then you can use the GitHub access token to create a new Tomatoes session as follow:
```Swift
let session = Session(provider: .github, accessToken: )
session.create { (result) in
switch result {
case .success: print("You are authenticated")
case .failure(let error): print(error?.localizedDescription ?? "no error description")
}
}
```
__Note: Tomatoes new session requests will return an access token that the SDK will store in the keychain. The SDK will try to apply the token stored in the keychain to send requests to Tomatoes that need authentication.__### Request user info
```Swift
User.read { (result) in
switch result {
case .success(let user): print(user.name)
case .failure(let error): print(error?.localizedDescription)
}
}
```