Posts

Post not yet marked as solved
0 Replies
326 Views
I was wondering if someone could explain or direct me to an explanation of why there's a need to work with UIKit late in the project (https://developer.apple.com/tutorials/swiftui/interfacing-with-uikit#introduction). What is it about that section of the tutorial that can't be accomplished using only SwiftUI? I find the pre-SwiftUI Swift code to be extremely confusing and very repetitive–given that a lot of the code can be prefilled by Xcode (for example, when creating a UIViewControllerRepresentable, it will automatically insert a ton of protocol-stub code from the error/Fix window), so I'm also trying to figure out just what it is that SwiftUI can't do that Swift can. So if anyone has found a site or book that explains what SUI still can't handle, I'd love to hear back, as I haven't been able to find one myself.
Posted Last updated
.
Post marked as solved
3 Replies
2.3k Views
When I run SF Symbols, I get a "Fonts Mismatch" error. It claims that newer versions of all the SF-Pro-[Display/Rounded/etc.] family (save the italics ones) are available. The link it sends me to apparently still has the older versions. I've deleted the 'older' versions of the font files and then run the SF-Pro font installer off the downloaded disk image; error just continues to appear.
Posted Last updated
.
Post not yet marked as solved
3 Replies
1.6k Views
Curious to know if anyone understands why I'm getting the following error "Cannot preview in this file" - [appname] crashed" Running the code on my (wirelessly) attached iPhone XR works, but the in-Xcode Preview window doesn't. Here's the log produced by the Diagnostics option: <Well, I tried to attach the zip file created from the previews-diagnostics-##-## folder, but this text field wouldn't accept that file type. Is there a particular file within the folder that I should upload instead?> Here's the code from the ContentView file for my (very basic) project: import SwiftUI struct ContentView: View { @FocusState private var amountIsFocused: Bool @State private var checkAmount = 0.0 @State private var numberOfPeople = 0 @State private var tipPercentage = 0 let tipPercentages = [0, 10, 15, 20, 25] var totalPerPerson: Double { let peopleCount = Double(numberOfPeople + 2) let tipSelection = Double(tipPercentage) let tipValue = tipSelection / 100 * checkAmount let grandTotal = checkAmount + tipValue let amountPerPerson = grandTotal / peopleCount return amountPerPerson } var totalAmount: Double { let tipSelection = Double(tipPercentage) let tipValue = tipSelection / 100 * checkAmount let grandTotal = checkAmount + tipValue return grandTotal } var body: some View { NavigationView { Form { Section { TextField("Amount", value: $checkAmount, format: .currency(code: Locale.current.currencyCode ?? "USD")) .keyboardType(.decimalPad) .focused($amountIsFocused) Picker("Number of people", selection: $numberOfPeople) { ForEach(2 ..< 100) { Text("\($0) people") } } } Section { Picker("Tip percentage", selection: $tipPercentage) { ForEach(0 ..< 101) { Text($0, format: .percent) } } } header: { Text("Select tip percentage") } Section { Text("Grand total: \(totalAmount, format: .currency(code: Locale.current.currencyCode ?? "USD"))") } Section { Text(totalPerPerson, format: .currency(code: Locale.current.currencyCode ?? "USD")) } header: { Text("Amount per person") } .navigationTitle("WeSplit") .navigationBarTitleDisplayMode(.inline) } .toolbar { ToolbarItemGroup(placement: .keyboard) { Spacer() Button("Done") { amountIsFocused = false } } } } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }
Posted Last updated
.
Post marked as solved
10 Replies
11k Views
After updating my iPhone/iPad to 15.3 last night, I tried to Run an app from XCode (13.2.1) on my Mac, but I'm getting the Failed to start remote service "com.apple.debugserver" on device. error. I can Run the app through the Simulator, so it's not life-or-death, but I find running the apps on the phone easier to 'play' with. Anyone know if an XCode update is imminent to allow for testing on a device w/ the new iOS?
Posted Last updated
.