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

Cannot use classes marked with @objc in IB in Xcode8 and Swift 3. #552

Closed
jbaez opened this issue Oct 14, 2016 · 15 comments
Closed

Cannot use classes marked with @objc in IB in Xcode8 and Swift 3. #552

jbaez opened this issue Oct 14, 2016 · 15 comments
Assignees

Comments

@jbaez
Copy link
Contributor

jbaez commented Oct 14, 2016

After upgrading my project to Swift 3 and Material 2 I had an issue when compiling with messages similar to: "Unknown class _TtC8Material4View in Interface Builder file".
I turns out that in IB when setting the Custom Class it didn't show "Material" in the module section dropdown for some classes.
The classes that had this issue also had the @objc attribute. I removed the attribute and then it showed "Material" in module section dropdown and compiled/worked without problems.

Classes that I found to have this issue are:

  • Switch
  • View
  • Button
@daniel-jonathan
Copy link
Member

Can you send a sample to [email protected]? The class names have changed and this may be the issue. We have samples in Storyboards that use classes with @objc. Thank you :)

@jbaez
Copy link
Contributor Author

jbaez commented Oct 17, 2016

I created a simple sample project recreating the issue and sent it by email.

These is what I'm using:

  • OSX El Capitan (10.11.6)
  • Xcode 8 and Swift 3
  • Cocoa pods 1.0.1

Thanks.

@daniel-jonathan
Copy link
Member

Excellent, thank you. I received your email. I will be taking a look shortly.

@daniel-jonathan
Copy link
Member

Looking now :)

@daniel-jonathan
Copy link
Member

You are correct. There is a warning. I believe it is because the @objc for those classes are not needed. I have removed them and there will be a release later today with the update. Thank you for bringing this to my attention :)

@markst
Copy link
Contributor

markst commented Apr 11, 2017

I seem to be experiencing this issue with TextView.
Works fine if I remove @objc(TextView). But I wonder if there's a better workaround to support objective-c & interface builder modules without subclassing again.

My current workaround is:

class NotesTextView : TextView { }

@daniel-jonathan
Copy link
Member

Hmmm... @markst can I see your setup code please? Thank you!

@markst
Copy link
Contributor

markst commented Apr 12, 2017

I'll have to put together a demo project. But it would simply be to create a project - install Material. Create a storyboard with a UITextView then define TextView as the class type:
image

@daniel-jonathan
Copy link
Member

Cool, if you can do exactly that where the issue is reproducible, it would be great. Normally I would do it, but I have a lot to do at the moment. Thank you!

@markst
Copy link
Contributor

markst commented Apr 13, 2017

Not sure if this is something further introduced in xcode 8.3

But it's also happening to PageTabBarController:

Unknown class _TtC8Material20PageTabBarController in Interface Builder file.

Again resolution is to remove the @objc(PageTabBarController).

Afraid I can't provide any more details on reproducing, otherwise I'd fix the problem & PR myself.

@daniel-jonathan
Copy link
Member

I'll test and make a release for this today :) Thank you! @markst

@nikkumbhani
Copy link

nikkumbhani commented Apr 17, 2017

Please Send me sample project which have integrate the material design source frame work

i getting error Used of unresolved identifier 'objc_getAssociatedObject' in Material+Obj-C.swift File

  • Xcode 8.1 and Swift 3.0

@ :- [email protected]
Help me as soon as Possible.

@daniel-jonathan
Copy link
Member

@NikunjKumbhani There is an entire repo of samples https://github.com/CosmicMind/Samples :)

@nikkumbhani
Copy link

Thanks A lot @DanielDahan

@daniel-jonathan
Copy link
Member

You can find a fix for this in Material 2.7.0 :)

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

No branches or pull requests

4 participants