tobihagemann / THLabel

UILabel subclass, which additionally allows shadow blur, inner shadow, stroke text and fill gradient.
https://tobiha.de
Other
669 stars 110 forks source link

IBDesignable issue and CocoaPods #28

Open pronebird opened 9 years ago

pronebird commented 9 years ago

Did you manage to make it work on IB and CocoaPods?

While properties show up in IB, they are not rendered, I get this error:

Storyboard.storyboard: error: IB Designables: Failed to update auto layout status: Failed to load designables from path (null)

tobihagemann commented 9 years ago

I haven't heard of this issue yet. Are you sure this is a CocoaPods issue? Are you using Xcode 6? I'm not sure where to go from here, have you tried the example project?

pronebird commented 9 years ago

I use Xcode 6.1.1 GM. I assume it's a problem with pods but I may be wrong. I'll re-check again. Haven't tried example project.

On Monday, December 1, 2014, Tobias Hagemann notifications@github.com wrote:

I haven't heard of this issue yet. Are you sure this is a CocoaPods issue? Are you using Xcode 6? I'm not sure where to go from here, have you tried the example project?

— Reply to this email directly or view it on GitHub https://github.com/MuscleRumble/THLabel/issues/28#issuecomment-65040522.

tobihagemann commented 9 years ago

If you still find this issue, it would be great if you could send me a minimal project example to tobias.hagemann@gmail.com so that I can look into it!

pronebird commented 9 years ago

I integrated THLabel in one of my apps but later dropped it as the idea of labels customizations has been cancelled. I'll let you know if this pops up in further when I use it next time.

chakming commented 9 years ago

@pronebird seems the issue is related to Cocoapods: https://github.com/CocoaPods/CocoaPods/issues/2792

@MuscleRumble trying the example project cannot simulate the issue. It's not using Cocoapods to use THLabel.

tobihagemann commented 9 years ago

Thanks for the info @chakming! :) So... I have to wait for Frameworks support?

chakming commented 9 years ago

I guess so. At this moment, the only way to render them correctly in Interface Builder, is to import THLabel manually, instead through Cocoapods...but I still prefer Cocoapods installation haha

tobihagemann commented 9 years ago

Yeah, CocoaPods should be the way to go. Too bad. :grin:

pronebird commented 9 years ago

I'll check if this bug fixed in 6.1.1.

gurgeous commented 9 years ago

I attempted to use THLabel through cocoapods and IBDesignable didn't work. Interface Builder complained and then stopped updating the label. After that it wouldn't let me update any properties either.

Eventually I worked around the problem by moving THLabel.* into my project and commenting out IBDesignable/IBInspectable.

IBDesignable in general seems to be quite buggy, especially with Swift. Sigh. You might want to consider removing support for IBDesignable until Xcode gets its act together.

tobihagemann commented 9 years ago

Thanks for your suggestion @gurgeous! I've released 1.4.6 and I'll just wait with IBDesignable until it all works out. :)

pronebird commented 9 years ago

NOOOOOOOooooooooooo! God damn it Apple, why you so broken.

troyzhao commented 9 years ago

oh, I have the same problem, I just drag the source code to my Xcode project and remove it from CocoaPods, it works well. I think this is a Xcode bug, Xcode can`t parse @IBDesignable class from a static lib

Eddpt commented 9 years ago

This is now working with Cocoapods (0.36.1.beta.1) and by adding use_frameworks! in your Podfile. More information here.

tobihagemann commented 9 years ago

Thanks for the info @Eddpt! To everyone who's interested in using THLabel with Interface Builder, should follow @Eddpt's instructions and use the ibdesignable branch:

pod 'THLabel', :git => 'https://github.com/MuscleRumble/THLabel.git', :branch => 'ibdesignable'

I'll keep this issue open until the new version of CocoaPods is out of beta. And when that happens, I'll merge the ibdesignable branch into master.

tobihagemann commented 9 years ago

CocoaPods 0.36 is now out of beta, but I'm not sure if I should merge ibdesignable branch into master. By adding use_frameworks! to your Podfile, you have to set your deployment target to at least iOS 8. Is this correct?

pronebird commented 9 years ago

Yep

— Cheers, Andrej

On Thu, Mar 12, 2015 at 1:10 AM, Tobias Hagemann notifications@github.com wrote:

CocoaPods 0.36 is now out of beta, but I'm not sure if I should merge ibdesignable branch into master. By adding use_frameworks! to your Podfile, you have to set your deployment target to at least iOS 8. Is this correct?

Reply to this email directly or view it on GitHub: https://github.com/MuscleRumble/THLabel/issues/28#issuecomment-78400446

tobihagemann commented 9 years ago

Hmmm... now I'm not 100% sure how to deal with this. I can think of several scenarios:

  1. Just keep the two branches and explain it in README. => Pro: Clean separation. => Con: Maintaining two branches. ;)
  2. Use __IPHONE_OS_VERSION_MIN_REQUIRED macro to check for deployment target. If it's >= __IPHONE_8_0, then activate IBDesignable features, otherwise not. ;) But this wouldn't check if Podfile is including use_frameworks! at all. Hmmm... :/ => Pro: One branch. => Con: Possible confusion for deployment targets >= iOS 8.0, when use_frameworks! is not specified in Podfile.
pronebird commented 9 years ago

What if pod built as framework you activate ibdesignable? I am sure there is some magic define for that ...

tobihagemann commented 9 years ago

That would be great! I've opened an issue at CocoaPods: https://github.com/CocoaPods/CocoaPods/issues/3265

Maybe there is some magic. :D If not, you just gave me another idea, which I like most now: Define my own macro (which defaults to NO) to flag if the user wants to use IBDesignable or not.

pronebird commented 9 years ago

custom define is PITA, CocoaPods should help to resolve that as it clearly impacts all of pods out there.

x2on commented 9 years ago

Any news on that?

tobihagemann commented 9 years ago

Unfortunately not, I'm still waiting for feedback from CocoaPods. If you want to use IBDesignable with THLabel, you can use the ibdesignable branch as mentioned here.

Kentzo commented 9 years ago

I confirm this issue with another view with and without the use_frameworks! flag: https://github.com/Kentzo/ShortcutRecorder/tree/cocoapods

drekka commented 9 years ago

Cocoa pods 3.7.1 does NOT fix the issue if your target < iOS 8 and you cannot use use_frameworks! in any such project. So this is not a fix.

Blackjacx commented 9 years ago

What is the fix now for projects supporting iOS versions lower than 7?!

tobihagemann commented 9 years ago

Just use the master branch and you should be good to go. I must admit, I haven't tested THLabel on iOS versions lower than 7 for a while now (and am unable to), but I believe it should still work with iOS 4 and higher.