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

IBDesignables and IBInspectables #335

Closed
raulriera opened this issue Feb 15, 2015 · 19 comments
Closed

IBDesignables and IBInspectables #335

raulriera opened this issue Feb 15, 2015 · 19 comments

Comments

@raulriera
Copy link
Contributor

Might not be an issue of Carthage per say. But I have ran into problems using IB Designables and IB Inspectables on frameworks using Carthage. Have you encountered this before?

Two examples are MengTo/Spring#11 (comment) and https://github.com/raulriera/TextFieldEffects both are affected by this

@robb
Copy link
Member

robb commented Feb 15, 2015

You happen to have a build log?

@raulriera
Copy link
Contributor Author

From carthage update? nothing stands out

*** Building scheme "Alamofire iOS" in Alamofire.xcworkspace
*** Building scheme "Alamofire OSX" in Alamofire.xcworkspace
*** Building scheme "KeychainAccess-iOS" in KeychainAccess.xcworkspace
*** Building scheme "KeychainAccess-Mac" in KeychainAccess.xcworkspace
*** Building scheme "OAuthSwift" in OAuthSwift.xcodeproj
*** Building scheme "Spring" in SpringApp.xcodeproj
*** Building scheme "SwiftyJSON" in SwiftyJSON.xcworkspace
*** Building scheme "TextFieldEffects" in TextFieldEffects.xcodeproj

Are the logs somewhere else?

@robb
Copy link
Member

robb commented Feb 15, 2015

Hmm, maybe running the latest carthage with --verbose?

@raulriera
Copy link
Contributor Author

Running version 0.6.0

Rauls-MacBook-Pro:Swish raulriera$ carthage update --verbose
*** Fetching OAuthSwift
*** Fetching Alamofire
*** Fetching SwiftyJSON
*** Fetching TextFieldEffects
*** Fetching KeychainAccess
*** Fetching Spring
*** Checking out KeychainAccess at "v1.1.2"
*** Checking out OAuthSwift at "v0.3.1"
*** Checking out Alamofire at "1.1.4"
*** Checking out TextFieldEffects at "0.2.7"
*** Checking out Spring at "1.0.1"
*** Checking out SwiftyJSON at "2.1.3"
*** Building scheme "Alamofire iOS" in Alamofire.xcworkspace
Build settings from command line:
    SDKROOT = iphonesimulator8.2

=== BUILD TARGET Alamofire iOS OF PROJECT Alamofire WITH CONFIGURATION Release ===

Check dependencies

Write auxiliary files
write-file /Users/raulriera/Library/Developer/Xcode/DerivedData/Alamofire-amhdqsdrikewnseofmecbiymyieb/Build/Intermediates/Alamofire.build/all-product-headers.yaml

=== BUILD TARGET Alamofire iOS Tests OF PROJECT Alamofire WITH CONFIGURATION Release ===

Check dependencies

** BUILD SUCCEEDED **

Build settings from command line:
    SDKROOT = iphoneos8.2

=== BUILD TARGET Alamofire iOS OF PROJECT Alamofire WITH CONFIGURATION Release ===

Check dependencies

Write auxiliary files
write-file /Users/raulriera/Library/Developer/Xcode/DerivedData/Alamofire-amhdqsdrikewnseofmecbiymyieb/Build/Intermediates/Alamofire.build/all-product-headers.yaml

=== BUILD TARGET Alamofire iOS Tests OF PROJECT Alamofire WITH CONFIGURATION Release ===

Check dependencies

** BUILD SUCCEEDED **

*** Building scheme "Alamofire OSX" in Alamofire.xcworkspace
Build settings from command line:
    SDKROOT = macosx10.10

=== BUILD TARGET Alamofire OSX OF PROJECT Alamofire WITH CONFIGURATION Release ===

Check dependencies

Write auxiliary files
write-file /Users/raulriera/Library/Developer/Xcode/DerivedData/Alamofire-amhdqsdrikewnseofmecbiymyieb/Build/Intermediates/Alamofire.build/all-product-headers.yaml

=== BUILD TARGET Alamofire OSX Tests OF PROJECT Alamofire WITH CONFIGURATION Release ===

Check dependencies

** BUILD SUCCEEDED **

*** Building scheme "KeychainAccess-iOS" in KeychainAccess.xcworkspace
Build settings from command line:
    SDKROOT = iphonesimulator8.2

=== BUILD TARGET KeychainAccess-iOS OF PROJECT KeychainAccess WITH CONFIGURATION Release ===

Check dependencies

Write auxiliary files
write-file /Users/raulriera/Library/Developer/Xcode/DerivedData/KeychainAccess-cppqcrfovwbmstejuakttxewmqiu/Build/Intermediates/KeychainAccess.build/all-product-headers.yaml

=== BUILD TARGET KeychainAccess-iOSTests OF PROJECT KeychainAccess WITH CONFIGURATION Release ===

Check dependencies

** BUILD SUCCEEDED **

Build settings from command line:
    SDKROOT = iphoneos8.2

=== BUILD TARGET KeychainAccess-iOS OF PROJECT KeychainAccess WITH CONFIGURATION Release ===

Check dependencies

Write auxiliary files
write-file /Users/raulriera/Library/Developer/Xcode/DerivedData/KeychainAccess-cppqcrfovwbmstejuakttxewmqiu/Build/Intermediates/KeychainAccess.build/all-product-headers.yaml

=== BUILD TARGET KeychainAccess-iOSTests OF PROJECT KeychainAccess WITH CONFIGURATION Release ===

Check dependencies

** BUILD SUCCEEDED **

*** Building scheme "KeychainAccess-Mac" in KeychainAccess.xcworkspace
Build settings from command line:
    SDKROOT = macosx10.10

=== BUILD TARGET KeychainAccess-Mac OF PROJECT KeychainAccess WITH CONFIGURATION Release ===

Check dependencies

Write auxiliary files
write-file /Users/raulriera/Library/Developer/Xcode/DerivedData/KeychainAccess-cppqcrfovwbmstejuakttxewmqiu/Build/Intermediates/KeychainAccess.build/all-product-headers.yaml

=== BUILD TARGET KeychainAccess-MacTests OF PROJECT KeychainAccess WITH CONFIGURATION Release ===

Check dependencies

** BUILD SUCCEEDED **

*** Building scheme "OAuthSwift" in OAuthSwift.xcodeproj
Build settings from command line:
    SDKROOT = iphonesimulator8.2

=== BUILD TARGET OAuthSwift OF PROJECT OAuthSwift WITH CONFIGURATION Release ===

Check dependencies

Write auxiliary files
write-file /Users/raulriera/Library/Developer/Xcode/DerivedData/OAuthSwift-fkzcstfheshntzfeppqgdcufkpva/Build/Intermediates/OAuthSwift.build/all-product-headers.yaml

** BUILD SUCCEEDED **

Build settings from command line:
    SDKROOT = iphoneos8.2

=== BUILD TARGET OAuthSwift OF PROJECT OAuthSwift WITH CONFIGURATION Release ===

Check dependencies

Write auxiliary files
write-file /Users/raulriera/Library/Developer/Xcode/DerivedData/OAuthSwift-fkzcstfheshntzfeppqgdcufkpva/Build/Intermediates/OAuthSwift.build/all-product-headers.yaml

** BUILD SUCCEEDED **

*** Building scheme "Spring" in SpringApp.xcodeproj
Build settings from command line:
    SDKROOT = iphonesimulator8.2

=== BUILD TARGET Spring OF PROJECT SpringApp WITH CONFIGURATION Release ===

Check dependencies

Write auxiliary files
write-file /Users/raulriera/Library/Developer/Xcode/DerivedData/SpringApp-ecjveguuknkpdmfmolgqugtwfecf/Build/Intermediates/SpringApp.build/all-product-headers.yaml

** BUILD SUCCEEDED **

Build settings from command line:
    SDKROOT = iphoneos8.2

=== BUILD TARGET Spring OF PROJECT SpringApp WITH CONFIGURATION Release ===

Check dependencies

Write auxiliary files
write-file /Users/raulriera/Library/Developer/Xcode/DerivedData/SpringApp-ecjveguuknkpdmfmolgqugtwfecf/Build/Intermediates/SpringApp.build/all-product-headers.yaml

** BUILD SUCCEEDED **

*** Building scheme "SwiftyJSON" in SwiftyJSON.xcworkspace
Build settings from command line:
    SDKROOT = iphonesimulator8.2

=== BUILD TARGET SwiftyJSON OF PROJECT SwiftyJSON WITH CONFIGURATION Release ===

Check dependencies

Write auxiliary files
write-file /Users/raulriera/Library/Developer/Xcode/DerivedData/SwiftyJSON-elstjcxdskukxabbgfdtjqqeyymk/Build/Intermediates/SwiftyJSON.build/all-product-headers.yaml

=== BUILD TARGET SwiftyJSONTests OF PROJECT SwiftyJSON WITH CONFIGURATION Release ===

Check dependencies

** BUILD SUCCEEDED **

Build settings from command line:
    SDKROOT = iphoneos8.2

=== BUILD TARGET SwiftyJSON OF PROJECT SwiftyJSON WITH CONFIGURATION Release ===

Check dependencies

Write auxiliary files
write-file /Users/raulriera/Library/Developer/Xcode/DerivedData/SwiftyJSON-elstjcxdskukxabbgfdtjqqeyymk/Build/Intermediates/SwiftyJSON.build/all-product-headers.yaml

=== BUILD TARGET SwiftyJSONTests OF PROJECT SwiftyJSON WITH CONFIGURATION Release ===

Check dependencies

** BUILD SUCCEEDED **

*** Building scheme "TextFieldEffects" in TextFieldEffects.xcodeproj
Build settings from command line:
    SDKROOT = iphonesimulator8.2

=== BUILD TARGET TextFieldEffects OF PROJECT TextFieldEffects WITH CONFIGURATION Release ===

Check dependencies

Write auxiliary files
write-file /Users/raulriera/Library/Developer/Xcode/DerivedData/TextFieldEffects-btvosowgienyuuevjqlkbsxsfnag/Build/Intermediates/TextFieldEffects.build/all-product-headers.yaml

** BUILD SUCCEEDED **

Build settings from command line:
    SDKROOT = iphoneos8.2

=== BUILD TARGET TextFieldEffects OF PROJECT TextFieldEffects WITH CONFIGURATION Release ===

Check dependencies

Write auxiliary files
write-file /Users/raulriera/Library/Developer/Xcode/DerivedData/TextFieldEffects-btvosowgienyuuevjqlkbsxsfnag/Build/Intermediates/TextFieldEffects.build/all-product-headers.yaml

** BUILD SUCCEEDED **

@robb
Copy link
Member

robb commented Feb 15, 2015

Hmm, seems to build correctly. If you build the framework without Carthage and integrate it, do your custom views show up correctly in Interface Builder?

@raulriera
Copy link
Contributor Author

Hmmm, building the project and the adding the resulting framework from the derived data folder has the same result (can't be used in Storyboards)... Maybe I am doing something wrong here with these frameworks

@robb
Copy link
Member

robb commented Feb 15, 2015

I'm tentatively closing this one then, since it seems to be either a configuration issue or an issue with Xcode. Feel free to reopen this if you have any new insights ✌️

@raulriera
Copy link
Contributor Author

Apparently this is a limitation in frameworks? when they are compiled all the IBDesignable and IBInspectable information is lost.

Have you guys ever created a reusable .framework file that supports them?

@yoichitgy
Copy link
Contributor

I had the same issue. It looks a limitation of a built framework. Check the header file (TargetName-Swift.h) in the built framework folder. It has no information for IBDesignable and IBInspectable though IBOutlet can be marked to properties in the header file. For now, the framework project must be added to your product project to enable IBDesignable and IBInspectable, or just use User Defined Runtime Attributes instead. I hope a future update of Xcode solve the issue.

@cybertk
Copy link

cybertk commented Sep 6, 2015

Still no good on Xcode 7 Beta 6

@BarlowTucker
Copy link

Has anyone else filed an issue with Apple yet?

https://openradar.appspot.com/23114017

@raulriera
Copy link
Contributor Author

I did, it was marked as duplicate a loooong time ago

@tylerlong
Copy link

tylerlong commented Jun 4, 2016

The issue was reported 16 months ago and there is still no ideal solution.

I have a workaround for this problem and I posted it onto stackoverflow: http://stackoverflow.com/questions/29933691/ibdesignable-from-external-framework/37631860#37631860 The basic idea is to create a sub class for the view in the destination app:

@IBDesignable
class MyCustomView: CustomView {

    @IBInspectable override var bgColor: NSColor {
        get {
            return super.bgColor
        }
        set {
            super.bgColor = newValue
        }
    }
}

Please read here for more details: http://stackoverflow.com/questions/29933691/ibdesignable-from-external-framework/37631860#37631860

If you like it please vote up. 👍

@defagos
Copy link

defagos commented Oct 12, 2016

I found a way to have designables work with Cocoa Touch frameworks. You can supply a source file where designable attributes are provided on categories, and which clients can then use when compiling their project.

For full details, please read http://stackoverflow.com/a/39999914/760435

@toshi0383
Copy link
Contributor

Forgive me commenting after closed, but I want to add a simple conclusion to this issue. It's sometimes hard to read all comments in SO for non-native English reader.

For library author, this solves the issue.
expose-ibbrabra

@agiguere
Copy link

Xcode 8 and Swift 3, 1 year later, still no solution ???

@farshadtx
Copy link

Still no solution to this issue ?

@SirWellington
Copy link

Bump. Any word?

@mdiep
Copy link
Member

mdiep commented Oct 3, 2017

This is an Apple/Xcode limitation. It’s not something that Carthage can fix.

@Carthage Carthage locked and limited conversation to collaborators Oct 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests