AppDelegate
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
MySizeIDEngine.sharedInstance().initalize(withKey: <your key>, andSecret: <your secret>)
return true
}
}
ViewController
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad() MySizeIDEngine.sharedInstance().startSession(self)
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated) MySizeIDEngine.sharedInstance().stopSession()
}
@IBAction func start(_ sender:UIButton){
MySizeIDEngine.sharedInstance().startMeasure(TYPE_CB, andIsMale: true, andUserID: "123", andHeight: 170, andWeight: 80)
}
@IBAction func getSize(_ sender:UIButton){
MySizeIDEngine.sharedInstance().getSize ("SIZE_CHART_CODE", andUserID: "USER_ID", onComplete: { (size) in
print(size)
}) { (error) in
print(error.localizedDescription)
}
}
@IBAction func resetMeasruments(_ sender:UIButton!){
MySizeIDEngine.sharedInstance().resetMeasruments("USER_ID", andIsMale: true, andHeight: 170, andWeight: 90, onComplete: {
print("Successfully reset all measurements")
}) { (error) in
print(error.localizedDescription)
}
}
}
extension ViewController:MeasureListenerBodyEngine{
func didFinishMeasureWithError(_ error: NSNumber!) {
DispatchQueue.main.async {
if error != 0{
print(error!)
}
}
}
}
Comments
0 comments
Please sign in to leave a comment.