This open-source library allows you to integrate a Rakuten MiniApp into your iOS applications. It also provides more features to interact with the native application via bridge.
- Load MiniApp list
- Load MiniApp meta-informations
- Create a MiniApp view
All the MiniApp files downloaded by the MiniApp iOS library are cached locally for efficiency
This module supports iOS 11.0 and above. It has been tested on iOS 11.0 and above.
It is written in Swift 5.0 and can be used in compatible Xcode versions.
In order to run your MiniApp you will have to provide the following,
- MiniApp host application identifier (RASApplicationIdentifier)
- Subscription key (RASProjectSubscriptionKey)
- Base URL for API requests to the library (RMAAPIEndpoint)
Generated documentation for this SDK can be found at https://rakutentech.github.io/ios-miniapp/
To run the example project, clone the repo, and run pod install
from the Example directory first.
In order to load your MiniApp, you will have to use your own Host App ID and your Subscription key. These can either be set in project configuration plist (RASApplicationIdentifier, RASProjectSubscriptionKey) or by taping the top right configuration icon in the example application. Also we don't currently host a public API, so you will need to provide your own Base URL for API requests by setting it in project configuration plist (RMAAPIEndpoint)
MiniApp is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'MiniApp'
In your project configuration .plist you should add 2 custom string target properties :
RASApplicationIdentifier
- to set your MiniApp host application identifierRASProjectSubscriptionKey
- to set your MiniApp subscription keyRMAAPIEndpoint
- to provide your own Base URL for API requests
If you don't want to use project settings, you have to pass this informations one by one to the Config.userDefaults
using a Config.Key
as key:
Config.userDefaults?.set("MY_CUSTOM_ID", forKey: Config.Key.subscriptionKey.rawValue)
MiniApp library calls are done via the MiniApp.shared()
singleton with or without a MiniAppSdkConfig
instance (you can get the current one with Config.getCurrent()
). If you don't provide a config instance, values in custom iOS target properties will be used by default.
MiniApp.shared().list { (result) in
...
}
or
MiniApp.shared(with: Config.getCurrent()).list { (result) in
...
}
MiniApp.shared().info(miniAppId: miniAppID) { (result) in
...
}
or
MiniApp.shared(with: Config.getCurrent()).info(miniAppId: miniAppID) { (result) in
...
}
MiniApp.shared().create(appInfo: info, completionHandler: { (result) in
switch result {
case .success(let miniAppDisplay):
let view = miniAppDisplay.getMiniAppView()
view.frame = self.view.bounds
self.view.addSubview(view)
case .failure(let error):
print("Error: ", error.localizedDescription)
}
}, messageInterface: self)
See the LICENSE file for more info.
- Initial release