Xcode Previews

RSS for tag

Create an app UI and configure almost everything your users see using Xcode Previews.

Xcode Previews Documentation

Posts under Xcode Previews tag

124 Posts
Sort by:
Post not yet marked as solved
3 Replies
5k Views
Hello, I’m not a developer but a regular user and while I was checking out iOS 15’s features I came across XCode Previews within the Accessibility > Per App Settings menu. I never downloaded this app and it did not appear in the Home Screen or App Library until I opened it with a Shortcuts > Scripting > Open App command. Now it appears in the App Library but I am unable to remove it. Why is it in my phone? How can I remove it? Can it be maliciously accessed? Please help removing it.
Posted
by Mindmusik.
Last updated
.
Post not yet marked as solved
10 Replies
4.3k Views
I am experiencing an issue where my Mac's speakers will crackle and pop when running an app on the Simulator or even when previewing SwiftUI with Live Preview. I am using a 16" MacBook Pro (i9) and I'm running Xcode 12.2 on Big Sur (11.0.1). Killing coreaudiod temporarily fixes the problem however this is not much of a solution. Is anyone else having this problem?
Posted
by joltguy.
Last updated
.
Post not yet marked as solved
3 Replies
2.9k Views
I used to be able to "right click" on the play button for a preview, but in Beta 1 and 2 of Xcode 13 that isn't working (neither is control clicking). Any ideas how to debug a preview short of running app in the simulator?
Posted Last updated
.
Post not yet marked as solved
1 Replies
164 Views
Hello, I'm new to the xCode so the question might seem trivial. However I haven't came across any solutions to my problem and tried literally everything. I'm not able to preview any content on the canvas. Keep getting an error saying: FailedToConnectToDTServiceHubError: Cannot connect to iPhone 12 Try disconnecting and reconnecting the device. iPhone 12 { }: connection attempt #1154 It's not the matter of previewing it on any device just wish to preview it inside the editor so I can work faster. The simulator is working just fine. Please, did anybody experience any similar issues? I can provide a report of the issue for the further verification. Kind regards, Hugo Czerniawski
Posted Last updated
.
Post not yet marked as solved
2 Replies
248 Views
Hi, i’m fairly new to Xcode. That aside, running the pre written code on previews which only prints “hello world” Gives me a “TimeoutError: Timed out waiting for connection to DTServiceHub after 15.0 seconds.”How can i fix this? I really wanna try out the visual editor.
Posted
by mssanad.
Last updated
.
Post not yet marked as solved
1 Replies
139 Views
When I open a new project in Xcode and run the preview the preview fails and I get the message “expected ‘{‘ in struct”. This is before I enter any new code
Posted Last updated
.
Post not yet marked as solved
0 Replies
171 Views
How can I write multi type of modifiers? I used this code and got error struct LibraryContent: LibraryContentProvider {   func modifiers(base: Image) -> [LibraryItem] {     LibraryItem(       base.resizedToFill(width: 100.0, height: 100.0),       title: "Image Resize To Fill",       category: .layout     )     LibraryItem(       base.normalText(font: .title2, weight: .bold),       title: "Text Normal",       category: .layout     )   } } extension Image {   func resizedToFill(width: CGFloat, height: CGFloat) -> some View {     self       .resizable()       .aspectRatio(contentMode: .fill)       .frame(width: width, height: height)   } } extension Text {   func normalText(font: Font, weight: Font.Weight) -> some View {     self       .font(font)       .fontWeight(weight)   } }
Posted
by hoithak.
Last updated
.
Post not yet marked as solved
2 Replies
300 Views
I have a project that runs smoothly and works on the Simulator, but does not render on the Canvas. Neither the Live Preview nor the view on the Canvas works and aborts with the error: MessageSendFailure: Message send failure for relaunch. I have attached the error log for you. I hope you guys can help me out. It sucks to work like this. By the way, it's not because of the swift file. Also with new SwiftUI views the error comes. What have I tried so far: reinstall xCode Clear build cache Create a new project Thanks for your help! previews_diagnostics_summary.txt
Posted Last updated
.
Post marked as solved
1 Replies
227 Views
One more similar to the previous problem. When I clicked the Resume button in the Preview section one hour ago... I have been still observing the process of "Preparing iPhone Simulator for Previews". Probably not developers but creators of xCode should support me and others to find a global solution... I would like to mention that the same process works properly when I use it for the Mac app development
Posted
by Mariox.
Last updated
.
Post marked as solved
2 Replies
251 Views
Hi guys, when I trzy to build an app using SwiftUI the preview preparation lasts for a very long time and finally I see a message about timeout: Timed out waiting for connection to DTService after 15.0 seconds. In addition it appears a window with the second one that the app MobileCal quit working unexpectedly. So I don’t know what to do. I would like to learn and use SwiftUI. In Building apps for Mac has been working properly but for iOS it is the Mission Impossible….
Posted
by Mariox.
Last updated
.
Post not yet marked as solved
17 Replies
4.7k Views
I'm trying out Xcode 12 (beta) and encountered an issue with TextField when viewing it in a live Preview. Although the view is interactive (scrolling vertically seems to be OK) and a cursor appears in the TextField view when it is clicked on, keyboard input is ignored. The same code works as expected in Xcode 11.5. Simulator in both 11.5 and 12 exhibits expected behaviour. Is this a bug? I know there is an issue with interactivity in Preview with multiple views inside PreviewProvider but I'd assumed this is if you'd added multiple Views to the same body of this struct.
Posted Last updated
.
Post marked as solved
1 Replies
252 Views
Previews don't work when are inside of a static framework. Has anyone experimented it also? MessageSendFailure: Message send failure for update ================================== |  RemoteHumanReadableError: Unknown preview provider "Provider_Previews_" |   |  XCPreviewAgent does not contain a preview provider named "Provider_Previews_". Check your build settings to ensure the preview provider is compiled into your product. |   |  Mangled name: 0012Provider_0021Provider_Previews_V Thanks in advance
Posted
by JesusMG.
Last updated
.
Post not yet marked as solved
1 Replies
196 Views
Hi all, I'm trying to preview a very simple view in a project I have in SwiftUI, and I'm getting this error regardless of the view I'm trying to preview: ---------------------------------------- LinkDylibError: Failed to build PreferencesView.swift Linking failed: linker command failed with exit code 1 (use -v to see invocation) ld: warning: directory not found for option '-F/Applications/Xcode-13.3.1.app/Contents/SharedFrameworks-iphonesimulator' Undefined symbols for architecture x86_64: "___asan_init", referenced from: _asan.module_ctor in Pods_Remoti(Pods-Remoti-dummy.o) "___asan_version_mismatch_check_apple_clang_1316", referenced from: _asan.module_ctor in Pods_Remoti(Pods-Remoti-dummy.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) ================================== (I'm attaching the whole error in the post, because it's way too long) Am I doing something wrong here? Thanks in advance!
Posted
by noloman.
Last updated
.
Post marked as solved
8 Replies
3.2k Views
In my current project, previews barely work. Most of the time, the following error is displayed on top: Cannot preview in this file -- Unexpected error occurred Sometimes, refreshing works by clicking the Try Again button, but usually that takes multiple tries. When I click the Diagnostics button, the following error is shown: HumanReadableSwiftError ConfigurationError: noPreviewInfos(arch: "x86_64", sdkRoot: "/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.2.sdk") This happens both in Xcode 12 and the beta Xcode 12.2. Who has a solution for this?
Posted
by bartvk.
Last updated
.
Post not yet marked as solved
0 Replies
262 Views
Hello, I am building game with SpriteKit. 2 or 3 days ago my code worked perfectly then some project files paths changed in my computer. So now my code is running on preview but it's not running on simulator. I got error message like this Thread 1: signal SIGABRT 2022-04-17 23:48:25.927505+0300 MultiplayerGame[58416:1308997] fopen failed for data file: errno = 2 (No such file or directory) 2022-04-17 23:48:25.927569+0300 MultiplayerGame[58416:1308997] Errors found! Invalidating cache... 2022-04-17 23:48:26.015933+0300 MultiplayerGame[58416:1309280] Execution of the command buffer was aborted due to an error during execution. The operation couldn’t be completed. (MTLCommandBufferErrorDomain error 9.) 2022-04-17 23:48:26.016392+0300 MultiplayerGame[58416:1309280] Execution of the command buffer was aborted due to an error during execution. The operation couldn’t be completed. (MTLCommandBufferErrorDomain error 9.) XPC_ERROR_CONNECTION_INTERRUPTED dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/mkg/Library/Developer/Xcode/DerivedData/MultiplayerGame-ghupaqvlksldiogzatxbetsvshfx/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMTLCapture.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib DYLD_FRAMEWORK_PATH=/Users/mkg/Library/Developer/Xcode/DerivedData/MultiplayerGame-ghupaqvlksldiogzatxbetsvshfx/Build/Products/Debug-iphonesimulator:/Users/mkg/Library/Developer/Xcode/DerivedData/MultiplayerGame-ghupaqvlksldiogzatxbetsvshfx/Build/Products/Debug-iphonesimulator/PackageFrameworks CoreSimulator 802.6 - Device: iPhone 12 Pro Max (50569CD6-26AA-45EF-BE07-3B5F9702915E) - Runtime: iOS 15.4 (19E240) - DeviceType: iPhone 12 Pro Max (lldb)
Posted
by mkg10.
Last updated
.
Post not yet marked as solved
1 Replies
672 Views
Hi, The canvas shows correctly all updates to the code, but when the run button is clicked, the keyboard is not working. I have tried a new project, deleted the simulator plist in the preferences, of course, cleaned and built again. Nothing works, and it is driving me nuts. I run the code on a device or a simulator, works as expected, just not in the canvass. Thought? Thanks so much! Blessings, --Mark
Posted Last updated
.
Post not yet marked as solved
2 Replies
221 Views
My canvas preview keeps crashing when I try to resume it. I tried restarting Xcode, my Mac, tried to change the files location, tried to change the device for the preview and nothing works. Strange thing is that the app builds successfully and runs on the simulator. I noticed that this happens when I use Source Control(GitHub) in my project. I will attach the crash log. Crash log
Posted Last updated
.
Post not yet marked as solved
3 Replies
400 Views
Hi there, after updating Xcode to 13.3 my Previews in all my Projects (with SwiftUI) stopped working. Every time i start the preview - the message send failure for capabilities - is showing up. I have reinstalled Xcode from web and App Store but nothing changed. I also deleted the "Developer Folder" in Library - nothing.. I don't know what i can do.... Thanks for your help
Posted
by Noem.
Last updated
.
Post marked as solved
1 Replies
194 Views
I've tried to create a simple CoreData entity and use the PreviewProvider to display the results. This worked fine (The first entity that got displayed was the GoalInformation). After this i've extended my entity with a relationship to another entity. This is a screenshot from the Xcode editor: More information about the entities: This is my ContentView struct ContentView: View { @Environment(\.managedObjectContext) private var viewContext @FetchRequest( sortDescriptors: [NSSortDescriptor(keyPath: \Goal.information!.name, ascending: true)], animation: .default) private var items: FetchedResults<Goal> var body: some View { VStack { Text("count: \(items.count)") } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() .environment(\.managedObjectContext, PersistenceController.preview.container.viewContext) } } The preview of the PersistenceController looks like this: static var preview: PersistenceController = { let result = PersistenceController(inMemory: true) let viewContext = result.container.viewContext for _ in 0..<5 { let newItem = GoalInformation(context: viewContext) newItem.name = "Name" let newItem2 = Goal(context: viewContext) newItem2.information = newItem } do { try viewContext.save() } catch { let nsError = error as NSError debugPrint("\(nsError.code) + \(nsError.debugDescription)") } return result }() The init of the same struct is this: init(inMemory: Bool = false) { container = NSPersistentCloudKitContainer(name: "goalz_two") if inMemory { container.persistentStoreDescriptions.first!.url = URL(fileURLWithPath: "/dev/null") } container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error as NSError? { debugPrint("\(error.code) + \(error.description)") } }) } When i want to display it by clicking "Resume" this is the error I receive. Some more infos: Error Domain=FBProcessExit Code=4 "The process crashed." UserInfo={NSLocalizedFailureReason=The process crashed., BSErrorCodeDescription=crash, NSUnderlyingError=0x600002e0fc00 {Error Domain=signal Code=4 "SIGILL(4)" UserInfo={NSLocalizedFailureReason=SIGILL(4)}}} ---------------------------------------- MessageSendFailure: Message send failure for relaunch ================================== | RemoteHumanReadableError: The operation couldn’t be completed. Transaction failed. Process failed to launch. (process launch failed) | | BSTransactionError (1): | ==error-reason: process launch failed | ==transaction: <FBApplicationProcessLaunchTransaction: 0x600001931340> | ==NSLocalizedFailureReason: Transaction failed. Process failed to launch. (process launch failed) | ==precipitating-error: Error Domain=FBProcessExit Code=4 "The process crashed." UserInfo={NSLocalizedFailureReason=The process crashed., BSErrorCodeDescription=crash, NSUnderlyingError=0x600002e0fc00 {Error Domain=signal Code=4 "SIGILL(4)" UserInfo={NSLocalizedFailureReason=SIGILL(4)}}} | ==error-description: Process failed to launch. I'm so confused, because it worked when there was no relationship and i've only created one entity. Hope someone can help me out... Using Xcode Version 13.2.1 on macOS 12.3
Posted
by roblv.
Last updated
.