Questions tagged [xcode-previews]
15 questions
9
votes
0 answers
SwiftUI.PreviewProvider MainActor isolation warning
I am receiving two (duplicate) warnings about concurrency on a file that is simply a SwiftUI View. This has started to happen after I have added Swift Concurrency on other parts of the codebase.
The full warning is: SwiftUI.PreviewProvider Main…

Pink
- 521
- 4
- 13
6
votes
1 answer
SwiftUI canvas preview displaying multiple views for one view
My SwiftUI preview is showing one view as 3 different preview screens and it should be one screen with the combined views...
What am I doing wrong?
Thank you!
See images attached of 3 separate preview views.
struct SignupSelfie: View {
…
user14542817
6
votes
2 answers
SwiftUI Preview Sheet w/o Running Live Preview?
Update Xcode 13
The code sample below works as expected in Xcode 13.
Update from Apple Frameworks Engineer October 2020:
Unfortunately there is no current workarounds to let you preview this outside of the live preview.
Is it possible to create a…

Clay Ellis
- 4,960
- 2
- 37
- 45
5
votes
0 answers
SwiftUI Preview Canvas Module
I have 3 different configurations for my project (Local, Dev, Release) and I can't get SwiftUI preview to work.
Compiling failed: no such module 'MyProject'...
Objects-normal/x86_64/MyView.2.preview-thunk.swift:1:64: error: no such module…

zhuber
- 5,364
- 3
- 30
- 63
5
votes
0 answers
SwiftUI Preview not finding image of used framework
My project consists of a main iOS app project and three additional frameworks for Presentation, Domain and Data layers. My own frameworks are embedded in the main target. Third party frameworks are managed by CocoaPods and linked dynamically.
Now if…

the.blaggy
- 815
- 5
- 16
3
votes
2 answers
Xcode SwiftUI Preview Crashes, Simulator and Device Works Fine
At some point during the development of my SwiftUI app the canvas preview stopped loading. The app uses CoreData, and the crash log suggests issues with the persistence function. The app continues to work as expected on the device and using the…

Liam
- 35
- 1
- 4
3
votes
1 answer
Missing argument for parameter 'message' in call
I'm back with another question. I was following this guide: https://medium.com/@fs.dolphin/passing-data-between-views-in-swiftui-793817bba7b1
Everything worked from it, but the SecondView_Previews is throwing an error Missing argument for parameter…

programmingsushi
- 43
- 1
- 4
2
votes
1 answer
XCode Preview Error: "Replaced Accessor for 'keyWindow'"
Adding the some code to one of my files in XCode causes the following error to show when trying to run previews for that file:
Compiling failed: replaced accessor for 'keyWindow' occurs in multiple places.
The error only happens when the following…

Stoic
- 945
- 12
- 22
1
vote
0 answers
Clicks not working as taps in Xcode preview?
I followed a cool YouTube tutorial to make a random TabBar and initially it was all working just fine and then something happened and the taps now are just inert. Nothing happens!
I tried changing the target architecture in build settings but…

user1944491
- 559
- 1
- 8
- 24
1
vote
0 answers
cannot find $exercisePlan in scope (SwiftUI)
I'm trying to create a page that shows the detail view of an exercise so i passed in a binding variable exercisePlan but the previews say that it cannot ding $exercisePlan in scope even though it is already declared on top. I'm probably missing…

Zudoturiku
- 121
- 7
0
votes
0 answers
How do I keep my SwiftUI previews from running in the background after I close them?
I am developing a game with Swift / Xcode / SwiftUI, and Xcode's preview window is great for iterating on changes quickly. But I noticed that when I close the preview canvas, my app is still running in Activity Monitor, taking up lots of CPU, even…

keelo
- 211
- 1
- 2
- 6
0
votes
0 answers
Cannot run preview for watchOS complications when project is designed for both iOS and watchOS targets
This is my preview code:
struct MyPreview: PreviewProvider {
static var previews: some View {
if #available(iOSApplicationExtension 16.0, *) {
if #available(watchOS 9.0, *) {
MonthCheckerWidgetView(entry:…

Bartłomiej Semańczyk
- 59,234
- 49
- 233
- 358
0
votes
0 answers
SwiftUI(Core Data) - Xcode Preview stops, but does not crash
Although Xcode does not give me any information, I assumed that it is related to Core Data because it started since I changed codes related to Core Data.
My Code
I have many codes in my project, and I cannot show you the whole code because of word…

Minsoo Choo
- 161
- 3
- 9
0
votes
0 answers
SwiftUI CoreData Preview FetchedResults Crashing
I am having issues previewing my SwiftUI CoreData in the canvas. The app works as expected in the simulator and on device, but the preview is crashing any preview view that uses a FetchedResult or ObservedObject (which I may be using wrong?).
My…

Liam
- 35
- 1
- 4
-1
votes
1 answer
Errors on app and simulator not starting, Xcode 12.2
I have a question. My page is giving me an error. It says:
Fatal error: Couldn't parse Rest.json as Array:
dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.",…

HarriSN726
- 3
- 2