Obj-C version is available here.
Author: Corinne Krych, Daniel Passos
Level: Intermediate
Technologies: Swift 4, iOS, RHMAP, CocoaPods.
Summary: A demonstration of how to get started with RHMAP.
Community Project : Feed Henry
Target Product: RHMAP
Product Versions: RHMAP 3.7.0+
Source: https://github.com/feedhenry-templates/blank-ios-swift
Prerequisites: fh-ios-swift-sdk: 6+, Xcode: 9+, iOS SDK: iOS 9+, CocoaPods: 1.3.0+
Simple native iOS app to get you started with fh-ios-swift-sdk in RHMAP.
This application and its cloud services are available as a project template in RHMAP as part of the "Native iOS Blank Project" template.
If you wish to contribute to this template, the following information may be helpful; otherwise, RHMAP and its build facilities are the preferred solution.
- Clone this project
- Populate
blank-ios-app/fhconfig.plist
with your values as explained here. - Run
Pod install
- Open blank-ios-app.xcworkspace
- Run the project
NOTE: If you clone it manually to make the app buildable in RHMAP Build farm, replace the templating
%id%
inblank-ios-app\blank-ios-app-Info.plist
in the following block:
<key>CFBundleIdentifier</key>
<string>%id%</string>
In blank-ios-app/ViewController.swift
the synchronization loop is started.
override func viewDidLoad() {
super.viewDidLoad()
// FH.init using Swift FH sdk
// trailing closure Swift syntax
FH.init { (resp:Response, error: NSError?) -> Void in
if let error = error {
self.statusLabel.text = "FH init in error"
print("Error: \(error)")
}
self.statusLabel.text = "FH init successful"
print("Response: \(resp.parsedResponse)")
}
}
If your RHMAP is depoyed without TLS1.2 support, open as source blank-ios-app/blank-ios-app-Info.plist.plist
make sure the following line are uncommented:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>