Code Monkey home page Code Monkey logo

Comments (9)

tinymind avatar tinymind commented on June 1, 2024

PS: the same code works well on simulator.

from hotreloading.

johnno1962 avatar johnno1962 commented on June 1, 2024

Hi, I'm afraid Objective-C and on-device injection is a bad combination due to insufficient information being provided by the compiler to simulate dynamic loading.

from hotreloading.

tinymind avatar tinymind commented on June 1, 2024

Oops, that is a bad news.

from hotreloading.

johnno1962 avatar johnno1962 commented on June 1, 2024

It's not all bad news, there are just arbitrary things you need to avoid, for example if you remove the message to super in viewDidLoad in the example you should find it works.

from hotreloading.

tinymind avatar tinymind commented on June 1, 2024

Em, I removed [super viewDidLoad]; but it not works, same error happened.
Even if it could work by remove the message to super, it's not a perfect resolution cause usually we need to call super indeed.

from hotreloading.

johnno1962 avatar johnno1962 commented on June 1, 2024

Injection on device is currently not "a perfect solution". The error you're seeing is Injection complaining about missing Swift specific information not provided by Objective-C in the object file. My criteria for "working" is updating and not crashing. It works quite well for prototyping SwiftUI but aside from that no guarantees.

from hotreloading.

tinymind avatar tinymind commented on June 1, 2024

Is it possible to fix the problem in other way, like Runtime? Method swizzle instead of re-compile.

from hotreloading.

johnno1962 avatar johnno1962 commented on June 1, 2024

Not really without replicating some fairly complex code from inside the dynamic linker (for which the source is available). The current state is pretty much a "best effort" that works better than I expected as Swift seldom depends on pointers in memory initialised with the value of external symbols. Swift generally does everything through "accessors" which are functions I can use a slightly modified version of "fishhook" to "bind".

from hotreloading.

tinymind avatar tinymind commented on June 1, 2024

Got it, thanks for your patience.

from hotreloading.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.