Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

❌🫡🏽 Show reloaded result instantly without tapping the simulator #44

Closed
mattigrthr opened this issue Jun 30, 2022 · 5 comments

Comments

@mattigrthr
Copy link

First of all, thanks for open-sourcing this amazing repo. ❀️ A true time-saver!

I got it running but to be able to see the change I have to tap on the simulator. Would be neat to show the result instantly.

I'm guessing enabling the animation is meant for that.

Inject.animation = .interactiveSpring()

But I don't know where to place it. Xcode gives me an error no matter where I place it.

I'm using the @ObserveInjection var inject inside my ContentView.

My Xcode version is 13.4.1.

@krzysztofzablocki
Copy link
Owner

You definitely shouldn't need to touch simulator, mind recording a video and the code integration snippet you did?

@mattigrthr
Copy link
Author

Sure, this is a recording where I change the color of a button. It updates once I click on it.

Screen.Recording.2022-06-30.at.6.07.17.PM.mov

This is where I injected the snippet:

import SwiftUI
import Inject

struct ContentView: View {
    @ObserveInjection var inject
    @StateObject var viewRouter = ViewRouter()
    
    @ViewBuilder
    var body: some View {
          MainContainer(viewRouter: viewRouter).enableInjection()
    }
}

@mattigrthr
Copy link
Author

Also, I was following this YouTube video and it has the same behaviour: https://youtu.be/kk1DnjyLpUE

@krzysztofzablocki
Copy link
Owner

@mattigrthr add enableInjection and ObservedObject var in each view and you should get proper updates

@mattigrthr
Copy link
Author

Jupp, that works. πŸ‘πŸ½ Thanks for the swift reply @krzysztofzablocki! πŸ™ŒπŸ½

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants