1

I'm trying to use SwiftUI in my Objective-C project, so I use this following step: this article

after that, I'm success bridging this 2 files to my Objective-C project. but in my file SwiftUIFile.swift, my canvas cannot be resume. when I try to resume, nothing happened.

enter image description here

here's the code

import SwiftUI

@available (iOS 13.0, *)
struct DetailInterfacesUISwift: View {

    var labelName = ""

    var body: some View {
        Text(labelName)
    }
}

@available (iOS 13.0, *)
struct DetailInterfacesUISwift_Previews: PreviewProvider {
    static var previews: some View {
        DetailInterfacesUISwift()
    }
}

note 1. I already delete script in build phases, nothing happen 2. I already clean project and delete core simulator downloaded 3. And still not working.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Axel
  • 73
  • 1
  • 11
  • It is something project specific. I've created Storyboard-based Objective-C iOS 12.0 min-spec project, then added Swift class to create bridge, then added SwiftUI view & added available wrapper, and Preview just works. Tested with Xcode 11.2. – Asperi Feb 13 '20 at 11:34
  • What is your os version ? – Kishore Kumar Feb 13 '20 at 12:53
  • @Asperi my base project was iOS 11.0 but i tried change to iOS 12.0 . but doesn't work at all – Axel Feb 21 '20 at 10:04
  • @KishoreKumar macOS Catalina 10.15.1, project from 11.0 changed to 12.0 – Axel Feb 21 '20 at 10:05
  • @Axel please keep iOS version 13 because swiftUI is only supported from iOS - 13 – Kishore Kumar Feb 21 '20 at 10:23
  • @kisalready change to iOS version 13.0f, still no canvas in xcode. but if i create new project swfitUI, the canvas appeared. why is this happen? – Axel Feb 24 '20 at 05:39

0 Answers0