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

Subclass of CAShapeLayer not injected #243

Open
eduardbosch opened this issue Apr 17, 2018 · 2 comments
Open

Subclass of CAShapeLayer not injected #243

eduardbosch opened this issue Apr 17, 2018 · 2 comments

Comments

@eduardbosch
Copy link

Hi again 🙂

I'm having trouble with updating a class that extends CAShapeLayer. The log says it has been injected, but the app does do not reflect its changes.

The class is as simple as this:

public class SampleLayer: CAShapeLayer {
    public init(path: UIBezierPath, strokeColor: UIColor) {
        super.init()

        print ("initializing")
        self.path = path.cgPath
        self.strokeColor = strokeColor.cgColor
        self.lineWidth = 5

        self.fillColor = nil
    }

    required public init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

I'm sure that this init function is called every time I inject something as every time I inject something, the print('initializing') appears in the log. If I change the print message to print('another message'), when I save the file, the log continues to show 'initializing' message. The log also says that the SampleLayer swift file has been injected

Am I missing something o misconfigured something?

I'm using AppCode, but the problem happens also if I only use Xcode.

Thanks! 🎉

@johnno1962
Copy link
Owner

Injecting new instances of things can be a bit problematic as exactly where the “class object” the app messages to create the instance can be undefined and may or not contain your changes. This is a bit of an edge case.

@eduardbosch
Copy link
Author

So it happens that this class is not injected and the code is reexecuted with the old class?

Thanks. Even with this little problems, this tool is great!

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