Xcode Previews

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

Xcode Previews Documentation

Posts under Xcode Previews tag

80 results found
Post marked as unsolved
35 Views

SwiftUI SVG gradient support in Xcode 12

I've added an SVG image to the asset catalogue of a SwiftUI project in Xcode 12 beta 3, and set 'Render as' to 'original'. The gradient background in the SVG image gets rendered in different ways depending on the platform. In the Xcode's asset catalogue's preview, the gradient is rendered as a solid color In the MacOS version of the SwiftUI app, the gradient appears as a solid color as well In the iOS version of the SwiftUI app, the gradient appears as a solid white area. I understand Xcode is in beta and not everything feature is working and I was wondering if this is an issue (assuming it is a bug) that will be fixed in an upcoming beta version, or if I should switch to a different file format for my images.
Asked
Last updated .
Post marked as unsolved
28 Views

IBDesignable Xcode 12 not loading

In new Xcode 12 in storyboard IBDesignable is completely not loading. Is there way way to solve it? After loading the story board in attribute inspector it shows Designables Build failed and my all the views got broken. Please help
Asked
by leon2019.
Last updated .
Post marked as unsolved
29 Views

Unable to compile in playground in Xcode 12 but compiles normally in Playground APP

Newest Xcode 12(12A7209) updating from App Store, catalina 10.15.6 The following simple codes could not run normally in playground in Xcode. Get the following message: error: Execution was interrupted, reason: signal SIGABRT. import Foundation import SwiftUI import PlaygroundSupport struct ContentView: View {     let appleProducts: Array<String> = ["iPod", "iPhone", "Macbook", "Macbook Pro", "Mac Pro"]     var body: some View {         ScrollView(.horizontal, showsIndicators: false) {             HStack {                 ForEach(0..<5) {                     Text("\($0)")                 }             }         }     } } PlaygroundPage.current.setLiveView(ContentView())
Asked
by Edwardai.
Last updated .
Post marked as unsolved
6 Views

How does one get my iPad deployment app to match the test data contained in my preview?

Hi! I’m a complete noob when it comes to Xcode development so please bear with me. I built the Intro to SwiftUI Sandwiches app and have the Preview working in Xcode 12b4. I just upgraded my iPadPro to iOS14 and did a deployment to the device. No errors and notice that there are no sandwiches in the device app. I’ve reviewed the code and assume it’s because testStore is only passed to the previews (ContentView_Previews) My goal is to get my deployed app to match my preview. How does one go about having the testStore (and all its assets) be installed along with the app on my iPadPro (if it isn’t already) and have the default state of the app show up the same way as my preview on my device?
Asked
Last updated .
Post marked as unsolved
8 Views

SVE support in Xcode-beta?

I'm trying to understand if the Xcode beta includes support for SVE which then in theory might also mean Apple Silicon could have support for it since again in theory it's post armv8.2-a hardware. Obviously SVE is an optional feature, but as a software dev it'd be good to know one way or another. Certainly NEON will be around. From what I've seen neither #ifdef _ARMFEATURESVE nor #include <armsve.h> exist. yet: clang happily accepts -march=armv8-a+sve As it's more than reasonable that other defines or includes that are specific to the Apple ecosystem would be what to use thought I'd ask. Thanks!
Asked
by tgall-foo.
Last updated .
Post marked as unsolved
5 Views

WatchKit 1.0 apps are no longer installable on this watchOS version.

I have downloaded Xcode 12, the newest version, from App Store. On my exising iOS project, I added a WatchKit app with deployment target of watchOS 7.0. However, when I try to run the watch app on simulator, it tries to install then gives me this error in an alert: This app could not be installed at this time. Could not install at this time. WatchKit 1.0 apps are no longer installable on this watchOS version. I don't know what's wrong with the target that causes it to give this error. Like said before, the deployment target for the app is watchOS 7 and the app uses SwiftUI. I also can't get a preview on SwiftUI because it gives me the same error saying cannot install. I have another iOS project with a WatchKit app that is running just fine. Do you have this problem also or know how to resolve it? Any help is appreciated.
Asked
Last updated .
Post marked as solved
836 Views

SwiftUI Previews not working with Firebase

SwiftUI previews don't seem to work in Xcode 12, beta 5, when using Firebase Analytics. The app builds and runs fine to simulator or device, but fails generating SwiftUI preview for a widget with the following message: ld: in /Users/../.../Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector(FIRAnalyticsConnector_e321ed8e3db06efc9803f6c008e67a34.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/.../.../Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector' for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) It was working fine in beta 4. Anyone else seen this? Any ideas?
Asked
Last updated .
Post marked as unsolved
27 Views

Apple Silicon (DTK) Xcode 12 GM overwrote private arm64 frameworks to x64

So I didn't read the instructions too hard to continue using Xcode beta. I installed Xcode 12 gm and now Xcode 12 Beta won't even run at all. Xcode reports 2 issues in the console [MT] DVTPlugInLoading: Failed to load code for plug-in com.apple.dt.IDE.IDEiOSSupportCore (/Applications/Xcode-beta.app/Contents/PlugIns/IDEiOSSupportCore.ideplugin), error = Error Domain=NSCocoaErrorDomain Code=3587 "dlopen_preflight(/Applications/Xcode-beta.app/Contents/PlugIns/IDEiOSSupportCore.ideplugin/Contents/MacOS/IDEiOSSupportCore): Library not loaded: /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice   Referenced from: /Applications/Xcode-beta.app/Contents/PlugIns/IDEiOSSupportCore.ideplugin/Contents/MacOS/IDEiOSSupportCore   Reason: no suitable image found.  Did find: /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice: mach-o, but wrong architecture /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice: mach-o, but wrong architecture" UserInfo={NSLocalizedFailureReason=The bundle is damaged or missing necessary resources., NSLocalizedRecoverySuggestion=Try reinstalling and [CL_INVALID_DEVICE] : OpenCL Fatal Error : Failed to load the CPU device library: dlopen(/System/Library/Frameworks/OpenCL.framework/Libraries/libcldcpuengine.dylib, 6): image not found Xcode ends with the error: No Software-OpenCL renderer available. I'm not exactly inclined to reset this machine, and I can't find replacements for these files.
Asked
by IsaacPaul.
Last updated .
Post marked as unsolved
15 Views

"Failed to produce a diagnostic for expression; please file a bug report" error.

Why am I getting this error? There's another post similar to this, but it doesn't have any answers. import SwiftUI struct ContentView: View {          @State var clicked = 0          var numberValue = [1: "won", 9: "Nein!", 69: "nice.", 123: "321", 666: "ILLUMINATI", 6969: "very nice."]          func addOne() {         clicked += 1         print(clicked)     }     var body: some View {         VStack{             Text("Clicker: The Game")                 .font(.largeTitle)                 .fontWeight(.bold)                 .multilineTextAlignment(.center)                 .offset(y: -225)                          Text(numberValue[self.clicked] ?? String(self.clicked))                 .font(.system(size: 69))                 .offset(y: -125)                          Button(action: addOne) {             Text("Tap me!")                 .offset(y: -10)                 .font(.system(size: 30))                 .background(RoundedRectangle(cornerRadius: CGFloat, style: RoundedCornerStyle = .circular))                          }                      }     } } struct ContentView_Previews: PreviewProvider {     static var previews: some View {         ContentView()     } }
Asked
Last updated .
Post marked as unsolved
82 Views

Xcode 12 GM unable to submit

I've just download the Xcode 12 GM, and built my app with it, but when I try to submit I'm seeing the "Unable to Submit for Review - apps must be built with a public (GM) version of Xcode". I've cleaned and removed derived data, but no joy. Anyone else seeing it?
Asked
Last updated .
Post marked as unsolved
31 Views

Xcode 12 beta 6 runs slowly on my iMac

I have a late 2012 iMac running Catalina. I find it really weird that Xcode 12 runs slowly because I can run Xcode 11 fine. It takes forever to build (around 2 minutes), simulate (around 5 minutes), and preview (around 3 minutes) on Xcode 12. Heck, I don’t even bother to toggle the live preview option. But, this wasn’t the case when I still used Xcode 11. Will Apple be dropping support for older iMacs? How can I make it run faster? Specs: i5 3.2 Ghz Quad-Core 8 GB RAM 16MHz DDR3 1 TB storage GTX 675MX 1 GB
Asked
Last updated .
Post marked as unsolved
46 Views

Newbie: what flags do I need to set to compile homebrews for native ARM?

Sorry for the dumb question. I've got an Apple Developer Kit with an arm architecture. Calling things like $ uname -a and $ arch returns x86_64 and i386 respectively. Running brew commands like $ brew install rsync is cross-compiling for x86, presumably using the arm half of the xcode-beta universal dev tools. The result of this is a non-fat x86_64 binary interpreted by Rosetta2 which runs fine. I've got the the latest compilers - what command line switches do I need or how can I override the fact that the mac is advertising that it's i386?
Asked
by dgerrity.
Last updated .