Wednesday, November 11, 2026
HomeiOS Developmentios - How can a @IBDesignable UI part be applied right into...

ios – How can a @IBDesignable UI part be applied right into a SwiftUI view?

[ad_1]

I’m attempting to make use of ‘Playing cards’ part in my mission.

This mission is an iOS app created on Xcode 13 utilizing SwiftUI interface and never storyboard.

Playing cards has been put in utilizing cocoapods.

The documentation can not help as a result of it’s assuming that the mission makes use of the storyboard interface and never SwiftUI.

I attempted the next:

import SwiftUI
import Playing cards

struct ContentView: View {
    
    let card: CardHighlight = {
        let card = CardHighlight(body: .zero)
        return card
    }()
    
    var physique: some View {
        card
    }
}

However I get the two following errors on ‘card’ line:

Return sort of property ‘physique’ requires that ‘CardHighlight’ conform
to ‘View’

Static methodology ‘buildBlock’ requires that ‘CardHighlight’ conform to
‘View’

This CardHighlight has been created utilizing @IBDesignable.

How ought to or not it’s added to View part?

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments