Para was designed as a simple and modular backend framework for object persistence and retrieval.
It helps you build applications faster by taking care of the backend. It works on three levels -
objects are stored in a NoSQL data store or any old relational database, then automatically indexed
by a search engine and finally, cached.
This is the Swift client for Para for iOS, tvOS, macOS and watchOS.
Quick start
NOTE: This XCode project is broken when used with CocoaPods! I gave up fixing it since the release of XCode 10. Feel free to fix it and submit a pull request. Thanks!
CocoaPods
For the latest release in CocoaPods add the following to your Podfile:
use_frameworks!
pod 'ParaClient'
And install it with:
$ pod install
Swift Package Manager
Add ParaClient as a dependency to your Package.swift. For example:
import ParaClient
// avoid using the secret key on mobile devices
let client = ParaClient(accessKey: "ACCESS_KEY", secretKey:"")
client.signIn("facebook", providerToken: "fb_access_token", callback: { user in
if user != nil {
// success! user is authenticated, JWT token is saved on the device
// you can now call the API methods
}
})
It’s a bad idea to hardcode your Para secret key in your code because it will run in an insecure client-side environment. Instead use the signIn() method to get an access token (JWT) with limited client permissions. Think of it like this: API key+secret = full API access, paraClient.signIn() = limited API access for clients with JWT tokens.
You can have a special user object created just for your iOS app and assign it special permissions so that your app can access a part of the Para API before authenticating another real user. Read the documentation for more information about client permissions.
For granting resource permissions to your client users go to console.paraio.org where you can edit your app object and allow your users the call specific API methods.
iOS Client for Para
What is this?
Para was designed as a simple and modular backend framework for object persistence and retrieval. It helps you build applications faster by taking care of the backend. It works on three levels - objects are stored in a NoSQL data store or any old relational database, then automatically indexed by a search engine and finally, cached.
This is the Swift client for Para for iOS, tvOS, macOS and watchOS.
Quick start
NOTE: This XCode project is broken when used with CocoaPods! I gave up fixing it since the release of XCode 10. Feel free to fix it and submit a pull request. Thanks!
CocoaPods
For the latest release in CocoaPods add the following to your
Podfile
:And install it with:
Swift Package Manager
Add ParaClient as a dependency to your
Package.swift
. For example:Usage
Initialize the client in your code like so:
It’s a bad idea to hardcode your Para secret key in your code because it will run in an insecure client-side environment. Instead use the
signIn()
method to get an access token (JWT) with limited client permissions. Think of it like this: API key+secret = full API access,paraClient.signIn()
= limited API access for clients with JWT tokens. You can have a special user object created just for your iOS app and assign it special permissions so that your app can access a part of the Para API before authenticating another real user. Read the documentation for more information about client permissions. For granting resource permissions to your client users go to console.paraio.org where you can edit your app object and allow your users the call specific API methods.Requirements
Thanks
Special thanks to Christopher Sexton for porting the AWS Signature 4 algorithm to Swift. His code was used in this project and is also licensed under Apache 2.0.
Documentation
Read the Docs
Contributing
git checkout -b my-new-feature
)git commit -am 'Added a new feature'
)git push origin my-new-feature
)For more information see CONTRIBUTING.md
License
Apache 2.0