nsscreencast / comments

Public comments on NSScreencast.com
0 stars 0 forks source link

IBDesignable - NSScreencast #45

Open subdigital opened 3 years ago

subdigital commented 3 years ago

Written on 01/24/2015 10:35:15

URL: https://nsscreencast.com/episodes/138-ibdesignable

subdigital commented 3 years ago

originally written by Nick on 09/26/2014 08:15:35

Great stuff as usual, makes me wish for an "export as framework" feature in PaintCode.

Out of curiosity, have you experimented with Objective C, in particular with CoreGraphics drawing?
For some weird reason, whenever I change a UIColor property in IB, the code in drawRect() from my custom view seems to default to black.

Works fine in Swift though, so no real issue here, just curious.

Cheers

subdigital commented 3 years ago

originally written by Justin Walsh on 09/26/2014 19:40:12

Good stuff! Would you mind adding in those notes about using test images that are not bundled into the application please?

subdigital commented 3 years ago

originally written by subdigital on 09/26/2014 19:41:29

Ah, thanks for reminding me. (somehow I knew I’d forget) I will write it up this weekend!

subdigital commented 3 years ago

originally written by subdigital on 09/29/2014 22:05:56

Added this to the show notes.

subdigital commented 3 years ago

originally written by algal on 10/04/2014 01:51:34

A comment: It is no longer required to place an IBDesignable component in its own framework. You can preview it in IB, even if it is just a bunch of classes that are a part of your project

A question: I notice you add the new framework to the linked libraries, and ALSO in the build scheme. Is it necessary to add it to the build scheme? Doesn't Xcode figure out that it needs to build it, given that it's a linked library and within the same workspace?

subdigital commented 3 years ago

originally written by subdigital on 10/04/2014 06:02:17

Thanks for the tip! This was required in the betas, good to know that it's not a requirement anymore.

You are also probably right about the framework. I tend do this half because of habit and half because of paranoia that Xcode will get it wrong :)

subdigital commented 3 years ago

originally written by Joshua Emmons on 10/04/2014 15:48:57

It hasn't been required since Beta 3, but there's still a lot of misinformation about this out there. And I fear this screencast isn't helping the situation. Do you think you could add a correction or something? At least in the show notes?

subdigital commented 3 years ago

originally written by algal on 10/04/2014 17:32:00

Another thing to consider is that if you DO put your component in a separate framework, then in addition to setting up linking correctly, and "import" statements in every file that uses your module, you also need to use access qualifiers like "public" in order to be sure to expose all the designable properties.

This can be a helpful discipline, or an irritating errand, depending on your style and what stage you're at in development.

subdigital commented 3 years ago

originally written by algal on 10/04/2014 17:34:12

Thanks. That's good to know about the build scheme. I think these screencasts are great so I'm always eager to understand your thinking.

subdigital commented 3 years ago

originally written by subdigital on 10/07/2014 13:23:51

I will definitely add a correction to the show notes.

subdigital commented 3 years ago

originally written by subdigital on 10/07/2014 13:34:22

If you're taking over drawing, your view properties are going to be ignored. You would typically start off by filling your frame's rect with a solid color, or setting self.opaque = NO so that CG won't start with an all black context.

subdigital commented 3 years ago

originally written by michaelforrest on 01/08/2015 13:33:06

Can I just mention that although you no longer need to create an external framework to do this, it is still preferable if you have a big project. Otherwise each time you save the IBDesignable class your whole project will get rebuilt and you'll lose that fast feedback cycle. If it's in a framework you just have to wait for the framework to build each time.

subdigital commented 3 years ago

originally written by subdigital on 01/08/2015 14:04:21

I haven’t had a chance to use this on a large project yet, so this is definitely great to know. Thanks!