How can we change to another Lens line programmatically?
After my investigation, there are two ways to advance to go back or forward in Lens' line.
- Use LaunchData to send the line that we want to load.
- Enable the
automaticallyConfiguresTouchHandler
to true and let the user tap on the screen to go forward.
I want to jump to another line, using a custom SwiftUI Button, but applying the same lens with different LaunchData is not smooth; we see a white splash happening.
Is any way to achieve this?
Answers
-
@Jorge Costa Thanks for submitting your question in our forum! I'm sharing this with our team now to take a look. Will get back to you as soon as we can.
0 -
@Jorge Costa Could you explain in more details on what you mean by "Lens Line?" Not 100% we understand that.
0 -
Hello @Jorge Costa , it sounds like you may benefit from Remote APIs
With this setup, you could send a request from the Lens to the app, then within the app respond to the request with the new line to display once that SwiftUI Button is pressed. This way, the Lens will stay applied only once, but the information in the Lens can change via data you send in from the app.
0 -
@stevenxu with "Lens line" I mean a JSON file that we use on script to load and manage the lens state.
"global.storyData = [
{
"line": 1,
"text": " ",
"background": "bg_Plain",
"face": " ",
"effects": "Character for Picker"
},
{
"line": 2,
"text": " ",
"background": "bg_Plain",
"face": " ",
"effects": "pillow, Character for Picker, Picker with Face Inset"
}
]"Tapping on the PreviewView updates the line we are on. I would like to implement that programmatically.
@ForumChris thanks. I'll try that and let you now if it worked.
0