I wrote a another, very simple Xcode Swift /project that shows how to control your document from the iOS app it is embedded in.
I actually did this because I miss read another thread… and originally posted this there.
The poster wanted to refresh or restart the scene if the user came out of in Safari on an iPhone.
For some reason I read that as came out of an iOS app with a Hype document.
So any way here is the new simpler example.
The idea is to add Notification observers in the iOS app that listen to when the App has resigned active status or Enters the Foreground.
Resigning active states will happen when you come out of the app when you hit the home button.
The app enters the foreground when it is the active app.
Apart from show how you can use the native cocoa API to trigger changes in your document, it also show you how simple it is to control your document by sending javascript calls to the Hype document.
(In the example we do not send any calls from the Hype document to the App)
Here is a example Xcode project with all this in.
The Hype document has three scenes.
The first one has an Ellipse that moves to cross a line. When it does the scene will change to one with a Rect in animation (scene 2)
When we exit the app, the UIApplicationWillResignActiveNotification Notification will fire it’s function and the third scene ( splash scene )will fade in.
When we come back to the App, the UIApplicationWillEnterForegroundNotification Notification will fire it’s function and the first scene will fade in and start again.
Xcode 8 project
iOSHypeCalls.zip (287.4 KB)