dchakarov
dchakarov

Reputation: 9478

Adding a SwiftUI view to a UIKit app gives me a `Missing argument for parameter 'font' in call` error

I have an existing UIKit application, using Storyboards. I want to add a new view using SwiftUI. My app is targeting iOS 13. The moment I add the SwiftUI view via File -> New -> File... -> Swift UI View I get a compiler error on the line with the default label Text("Hello, World!"). Do I need to update some configuration somewhere to enable Swift UI?

Missing argument for parameter 'font' in call

Upvotes: 0

Views: 235

Answers (1)

Mojtaba Hosseini
Mojtaba Hosseini

Reputation: 119177

You probably have another type in your project named Text. You can differentiate it from the Text of SwiftUI by adding the module name before the type name:

var body: some View {
    SwiftUI.Text("Hello World!")
}

Upvotes: 2

Related Questions