Failed to render instance of IB Designables

前端 未结 15 656
情深已故
情深已故 2020-12-07 12:09

I have an Objective-C and Swift mixed dynamic framework. And the mixed framework was linked with two pure Objective-C dynamic frameworks.

When I tried to mark any cl

相关标签:
15条回答
  • 2020-12-07 12:56

    for me it works to close xcode and reopen it again. No errors after. Thanks.

    0 讨论(0)
  • 2020-12-07 12:58

    In my case it inside private pod. Xcode Version 10.3 (10G8)

    The solution is very simple in my case - I just forget to add public in-between of @IBInspectable var

    right variant:

    import UIKit
    
    @IBDesignable public class BorderedView: UIView {
        @IBInspectable public var borderColor: UIColor? = UIColor.white {
            didSet {
                if let actualColor = borderColor {
                    layer.borderColor = actualColor.cgColor
                } else {
                    layer.borderColor = UIColor.white.cgColor
                }
                
                setNeedsDisplay()
            }
        }
        @IBInspectable public var borderWidth: CGFloat = 1 {
            didSet {
                layer.borderWidth = borderWidth
                setNeedsDisplay()
            }
        }
    }
    

    P.S.: Editor -> Debug Selected Views did nothing in my case

    P.S.2 : AlignedCollectionViewFlowLayout pod from the dependency of my private pod and definitely not relevant to this issue.

    P.S.3: Issue still here

    0 讨论(0)
  • 2020-12-07 13:00

    Finally, I solved this issue by adding $(CONFIGURATION_BUILD_DIR) in the target's build settings' Runpath Search Paths field.

    Plus, there are some additional steps you might need to do with your Xcode.

    1. Clear Xcode derived data for the project. They are in ~/Library/Developer/Xcode/DerivedData
    2. Clean your current build by pressing K
    3. Build your project
    4. In storyboard go to Editor menu and do Refresh All Views; wait for build to be completed and errors should be gone

    Credit to @Mojtaba

    0 讨论(0)
提交回复
热议问题