TheJeff
TheJeff

Reputation: 4121

Build Error Previewing First SwiftUI View

I'm incorporating SwiftUI into my project for the very first time!

Unfortunately I can't preview my first SwiftUI file I add to the project. The build only fails on the preview. And the failure is in my tests.

Steps to build error:

  1. Click the "resume" button in the preview area for a newly created SwiftUI view.
  2. Build fails... I click the 'Diagnostics' button:

Diagnostics screen output:

missing required module 'JGProgressHUD'


SchemeBuildError: Failed to build the scheme "MyApp"

missing required module 'JGProgressHUD'

Compile AppTests.swift (x86_64): /Users/myname/Projects/MyApp/MyAppTests/Entities/AppTests.swift:11:8: error: missing required module 'JGProgressHUD' import MyApp ^

Yes, I have the JGProgressHUD lib imported via SPM.

This is what my test class looks like - it is failing on the import of "MyApp", but only for the preview of SwiftUI... there are no build failures for the app or tests otherwise...

import Foundation
import XCTest
import MyApp
// import app here because of: https://stackoverflow.com/questions/27172481/swift-singleton-init-called-twice-in-xctest

class AppTests: XCTestCase {
 // .. tests are here
}

Fails on the "Import MyApp" line.

Here's what I've tried:

I can't wait to use SwiftUI, but it seems pretty fickle so far adding to a new project, and I have no idea where else to look. Its such a random problem for what I'm trying to do, I am completely out of ideas for where to look.

Any ideas on what to check or look for?

Thanks for any help XCode sages!

Upvotes: 4

Views: 556

Answers (1)

TheJeff
TheJeff

Reputation: 4121

Apple fixed this in XCode 13 Beta 5.

Please verify and post here if Apple's fix has resolved your problem.

Upvotes: 1

Related Questions