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

Storyboard can't find PMSuperButton which integrated through Carthage #12

Closed
Banck opened this issue Jul 23, 2018 · 5 comments
Closed

Comments

@Banck
Copy link

Banck commented Jul 23, 2018

Hello!
I've placed UIButton in my storyboard and tried to type PMSuperButton in class, but there is no PMSuperButton. If wrote it there, then error:
Unknown class PMSuperButton in Interface Builder file.
But in .swift files I can import PMSuperButton , create and works with them.
Thanks!

@pmusolino
Copy link
Owner

Hi @Banck,

I think that this is an Xcode bug.

You must save your work and quit Xcode.

When you run Xcode again, you will see PMSuperButton class.

Let me know.
Thanks
-Paolo

@Banck
Copy link
Author

Banck commented Jul 24, 2018

@pmusolino Hey! No, it doesn't work. Other frameworks are working fine.

@pmusolino
Copy link
Owner

Can you show me how you imported the library? Is it in the right target?

@pmusolino pmusolino reopened this Jul 24, 2018
@Banck
Copy link
Author

Banck commented Jul 24, 2018

@pmusolino
In cartfile:
github "pmusolino/PMSuperButton"

Then added to the linked frameworks section. The target is setted and it's right target.
In the build phase:
Input file:
$(SRCROOT)/Carthage/Build/iOS/PMSuperButton.framework
output:
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/PMSuperButton.framework

I can import PMSuperButton in any swift file and work with them, but storyboard can't find PMSuperButton.

@pmusolino
Copy link
Owner

If you are the user of a framework with designable support:

  • Add the framework (and all its framework dependencies, if any) as embedded binary to your target
  • Retrieve the companion source file from the framework bundle and copy it into your project, adding it to your target. Adding the file located within the framework or using a symbolic link sadly does not work, as Xcode does not seem to look within frameworks at all
  • Add an instance of the designable view class (MyCustomView in our example above) to a storyboard. Interface Builder should build the project and render the view

This solution is not perfect since you still have to manually copy a supplied source file, which could change between framework versions. But it works pretty well, though, and provides everything required within the framework bundle itself.

More info here.

Let me know if this works for you.

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

No branches or pull requests

2 participants