Getting started
- Declare an URL scheme for your app, preferably just for importing files. Use an unique URL scheme, it’s very important! Don’t use URL schemes like
pisth-import
, try to include the name of your app, for example:myApp-pisth-import
. - Include the Pisth API framework: Drag the
Pisth API
andPisth_Shared
projects to your workspace and add theme to your app’s embedded binary. - Handle data received in your App delegate:
import Pisth_API
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) {
// Give your app's URL scheme for importing files.
Pisth.shared.urlScheme = "<YOUR APP URL SCHEME>"
}
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
// Getting data received
Pisth.shared.dataReceived
// Getting received file name
Pisth.shared.filename(fromURL: url)
}
- Now, start importing file calling
Pisth.shared.importFile()
.