Xcode Previews

RSS for tag

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

Posts under Xcode Previews tag

148 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

SSL Cert Interception | XCode Preview
Hello! My company makes use of SSL interception for its managed laptops (for various information security reasons). We've yet to find a good solution to avoid SSL cert errors in the Xcode Preview app. We've successfully installed/trusted our certs in the Xcode Simulator, but can't find any information on how to do the equivalent for the Xcode Preview. The inability to make use of the Preview App profoundly impacts productivity. It appears the Xcode Preview doesn't share the same certificate store as the Simulator, nor does it make use of the Mac's system keychain (where the certificates are also installed and trusted). If there’s anyone you can think of who might know a way around this issue it would be greatly appreciated. Many thanks!
1
0
86
1d
Xcode 16.0 + SwiftUI: Failed to launch app "MyApp.app" in reasonable time
I am working on transitioning an existing UIKit based app to SwiftUI. After adding a first SwiftUI file to the project preview fails with: Failed to launch app "MyApp.app" in reasonable time The View code is the default templates, thus definitly not too complex: import SwiftUI struct OverviewPageView: View { var body: some View { Text("Hello, World!") } } #Preview { OverviewPageView() } Things I have tried: Cleaning and rebuilding. Changing the target device. Using xcrun simctl shutdown all followed by scrub simctl erase all Clearing the contents of my ~/Library/Developer/Xcode/UserData/Previews folder. Clearing the contents of my ~/Library/Developer/Xcode/DerivedDatas folder. Using xcrun simctl --set previews delete all Restarting macOS and Xcode The problem seems tpbe related to my project. When creating a fresh new project using "Storyboard" as interface and adding a SwiftUI file, the preview works fine. However, this does not help when working on my existing project... I generated a preview diagnostics report. I am using Xcode 16.0 on macOS 15.0
3
2
123
3d
The iOS Simulator and preview in Xcode takes forever to load
I’ve recently begun learning how to utilize Xcode. I have an app in Xcode that closely resembles the iOS App template. Whenever I initiate a build, it successfully completes, but it never finishes installing views into the iOS Simulator. This issue is also present when I attempt to preview the app within the Xcode editor. I am currently using a 2020 MacBook Air (M1). Have you encountered a similar problem? If so, how did you resolve it? [Written using Apple Inteligence Writing Tools]
1
0
144
1w
Xcode Canvas preview connected to iPhone error
"Can not preview in this file" Xcode 16.0 iPhone 14 Pro , iOS 18.0 When I choose to start Preview on my iPhone, the canvas screen keeps showing loading circle animation. The iPhone enters the Xcode Previews App but only displays the default screen (Xcode icon& 'Preview from Xcode') I uploaded the some of diagnostics files previews_diagnostics_summary.txt remote_injection.json
3
0
160
1w
Firebase is not working on X-code 16 iOS 18 simulator
I have updated my firebase with the latest version, but on simulator, apple log in and parsing from firebase server is not working on iOS 18 when working fine on the actual test device. However iOS 17 simulator works perfect as X-Code 15. And previews are not working as well with my current app coding, which was coded in previous X-code 15. Is there any API changes? Any help? Or 18.1 might fix this bug?
1
0
174
1w
Swift Macro for SwiftUI Previews Not Recognized in Xcode
Here's a concise post for the Apple Developer Forums: Title: Swift Macro for SwiftUI Previews Not Recognized in Xcode Hello everyone, I've developed a Swift macro swift-inject-preview that generates SwiftUI previews (PreviewProvider or #Preview). However, Xcode seems to ignore the previews generated by the macro, likely because it searches for PreviewProvider/#Preview or similar text in the file before macro expansion. Has anyone encountered a similar issue or found a workaround for getting Xcode to recognize previews created through Swift macros? Any help or insight would be greatly appreciated! Thank you! Daniil Voidilov
1
0
111
1w
Xcode do not pause at breakpoints
In the latest version of Xcode, breakpoints are not displaying correctly, making it difficult to track code behavior. Previously, Xcode allowed you to step through each function, showing clear execution steps and allowing interaction to debug effectively. However, now it only shows memory addresses without providing meaningful insights, limiting the ability to interact with or test the code as it's being developed. Is anyone else experiencing this issue, or does anyone know of a workaround?
0
0
141
1w
#Preview a Widget placeholder?
While I am able to use #Preview to preview a Widget, it seems to be not possible to easily preview a Widget placeholder. With a "classic" preview I can use .redacted(reason: .placeholder), but this has limitation e.g. it will ignore .contentMarginsDisabled() struct MyWidget_Previews: PreviewProvider { static var previews: some View { Group { MyWidgetView(entry: SimpleEntry(date: .now, emoji: "😀")) MyWidgetView(entry: SimpleEntry(date: .now, emoji: "😀")) .redacted(reason: .placeholder) } .previewContext(WidgetPreviewContext(family: .systemMedium)) .containerBackground(.white, for: .widget) } } If I use #Preview, the .redacted modifier won't work, and I seem to have to put it in the MyWidget implementation. #Preview(as: .systemMedium) { MyWidget() } timeline: { SimpleEntry(date: .now, emoji: "😀") SimpleEntry(date: .now, emoji: "🤩") } Am I missing something?
1
0
177
2w
Xcode preview crash continuously
Hi. Just update my MacBook Pro M1 with sequoia and Xcode and I got huge problem with preview on simply swiftui pages. This is the full report I got when the preview crash but if I run the app on the device or the simulator it works fine. How can I solve this situation? the crashing thread is number 6 which reports this: Thread 6 Crashed:: Dispatch queue: com.apple.root.user-initiated-qos 0 XOJIT 0x240b899f8 llvm::Error llvm::detail::UniqueFunctionBase<llvm::Error, llvm::jitlink::LinkGraph&>::CallImpl<xojit::ReplacementManager::Plugin::modifyPassConfig(llvm::orc::MaterializationResponsibility&, llvm::jitlink::LinkGraph&, llvm::jitlink::PassConfiguration&)::'lambda'(llvm::jitlink::LinkGraph&)>(void*, llvm::jitlink::LinkGraph&) + 1784 1 XOJIT 0x240c1b46c llvm::jitlink::JITLinkerBase::runPasses(std::__1::vector<llvm::unique_function<llvm::Error (llvm::jitlink::LinkGraph&)>, std::__1::allocator<llvm::unique_function<llvm::Error (llvm::jitlink::LinkGraph&)>>>&) + 76 2 XOJIT 0x240c1ab68 llvm::jitlink::JITLinkerBase::linkPhase1(std::__1::unique_ptr<llvm::jitlink::JITLinkerBase, std::__1::default_delete<llvm::jitlink::JITLinkerBase>>) + 72 3 XOJIT 0x240c2158c llvm::jitlink::link_MachO_arm64(std::__1::unique_ptr<llvm::jitlink::LinkGraph, std::__1::default_delete<llvm::jitlink::LinkGraph>>, std::__1::unique_ptr<llvm::jitlink::JITLinkContext, std::__1::default_delete<llvm::jitlink::JITLinkContext>>) + 3608 4 XOJIT 0x240c20400 llvm::jitlink::link_MachO(std::__1::unique_ptr<llvm::jitlink::LinkGraph, std::__1::default_delete<llvm::jitlink::LinkGraph>>, std::__1::unique_ptr<llvm::jitlink::JITLinkContext, std::__1::default_delete<llvm::jitlink::JITLinkContext>>) + 72 5 XOJIT 0x240c19cc8 llvm::jitlink::link(std::__1::unique_ptr<llvm::jitlink::LinkGraph, std::__1::default_delete<llvm::jitlink::LinkGraph>>, std::__1::unique_ptr<llvm::jitlink::JITLinkContext, std::__1::default_delete<llvm::jitlink::JITLinkContext>>) + 80 6 XOJIT 0x240c0acc0 llvm::orc::ObjectLinkingLayer::emit(std::__1::unique_ptr<llvm::orc::MaterializationResponsibility, std::__1::default_delete<llvm::orc::MaterializationResponsibility>>, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>) + 256 7 XOJIT 0x240bfcbfc llvm::orc::BasicObjectLayerMaterializationUnit::materialize(std::__1::unique_ptr<llvm::orc::MaterializationResponsibility, std::__1::default_delete<llvm::orc::MaterializationResponsibility>>) + 60 8 XOJIT 0x240be3f08 llvm::orc::MaterializationTask::run() + 44 9 XOJIT 0x240b97e1c invocation function for block in (anonymous namespace)::GCDTaskDispatcher::dispatch(std::__1::unique_ptr<llvm::orc::Task, std::__1::default_delete<llvm::orc::Task>>) + 108 10 libdispatch.dylib 0x1801774ec _dispatch_call_block_and_release + 24 11 libdispatch.dylib 0x180178de0 _dispatch_client_callout + 16 12 libdispatch.dylib 0x18018b864 _dispatch_root_queue_drain + 1208 13 libdispatch.dylib 0x18018bf60 _dispatch_worker_thread2 + 232 14 libsystem_pthread.dylib 0x104db7b38 _pthread_wqthread + 224 15 libsystem_pthread.dylib 0x104db6934 start_wqthread + 8 Full Report
4
4
676
2w
Live Preview fails after adding 3rdParty libraries
With the latest Xcode 16 RC version, the Live Preview on iPhone device problem has been fixed. However, it still fails on the iPhone 16 pro preview emulator even for the simplest hello world view. Apparently in Xcode 16, introducing any 3rdParty package impacts the preview build, even if the package is not referenced in the view. I feel this is an incorrect behaviour. Following are the steps to reproduce the problem: Create a new iOS project in the latest Xcode 16 beta Select ContentView in the project and verify the live preview is working and fast Go the project’s Package Dependencies tab, add gRPC-Swift (https://github.com/grpc/grpc-swift.git) as a 3rdParty library of this project. Go the main project target, select General tab. Under Frameworks, Libraries, and Embedded Content section, add “GRPC” Go back to ContentView and verify its live preview rendering now takes very long time and eventually failed. Select Live Preview Diagnostic, verify error message: Failed to launch app ”PreviewBug.app” in reasonable time… I have also created a feedback to Apple: FB15110765
2
0
229
4w