Post

Replies

Boosts

Views

Activity

Reply to Binding with optional Value causes runtime crash
The property is already a published entity in an observable object. Any changes to the name property will be propagated to the SwiftUI view. The issue was your nameBinding property. Unwrapping viewModel.name is you really had to do then passed the value into a Binding init constant as seen here ChildView(selectedName: .constant(name)). struct ParentView: View { @StateObject var viewModel = Model() var body: some View { VStack(alignment: .leading, spacing: 8) { Text("Name is \(viewModel.name ?? "nil")") Button("Make name nil") { viewModel.makeNameNil() } if let name = viewModel.name { ChildView(selectedName: .constant(name)) } } .padding() } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’23
Reply to Using swift or other tool to tell if printer is connected and ready for prints
This will only be true or false if a printer is defined and available and the NSPrinter.printerNames list is non-empty. func isConnectedToPrinter() -> Bool { let printers = NSPrinter.printerNames return !printers.isEmpty } see this GitHub resource on how to query the info you're seeking. https://github.com/marc-medley/004.42Apple_CorePrintingExample/blob/3481a1c8c253f98bbff19741a13cd2c9b8d1d88b/PDFPagePrinter/PDFPagePrinter/PrintData.swift#LL190C9-L203C10 // Printer State var printerState: PMPrinterState = 0 let _ = PMPrinterGetState(pmPrinter, &printerState) d["printerState"] = printerState switch printerState { case UInt16(kPMPrinterIdle) : d["printerStateName"] = "kPMPrinterIdle" case UInt16(kPMPrinterProcessing) : d["printerStateName"] = "kPMPrinterProcessing" case UInt16(kPMPrinterStopped) : d["printerStateName"] = "kPMPrinterStopped" default: d["printerStateName"] = "UNSPECIFIED" } Sean
Topic: UI Frameworks SubTopic: AppKit Tags:
May ’23
Reply to SecTrustSettingsSetTrustSettings cause errSecInternalComponent
I'm a bit rusty on this but this came up in 2011 and the solution was to reinstall the OS -> https://discussions.apple.com/thread/3067155?answerId=15233086022#15233086022
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
May ’23
Reply to iOS 16.4.1 incompatible with Xcode 14.3
No issues with my setup. iPhone 13.
Replies
Boosts
Views
Activity
May ’23
Reply to While uploading IPA to App Store Connect got this error: "*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil (-1010)"
Also, what version of Xcode are you using?
Replies
Boosts
Views
Activity
May ’23
Reply to Cuenta Pendiente
Just wait a bit longer; your turn is somewhere in the queue.
Replies
Boosts
Views
Activity
May ’23
Reply to macOS 13.4 RC don't recognized dev account on MDM enrolled devices
Would you be missing a permission on the MDM?
Replies
Boosts
Views
Activity
May ’23
Reply to Binding with optional Value causes runtime crash
The property is already a published entity in an observable object. Any changes to the name property will be propagated to the SwiftUI view. The issue was your nameBinding property. Unwrapping viewModel.name is you really had to do then passed the value into a Binding init constant as seen here ChildView(selectedName: .constant(name)). struct ParentView: View { @StateObject var viewModel = Model() var body: some View { VStack(alignment: .leading, spacing: 8) { Text("Name is \(viewModel.name ?? "nil")") Button("Make name nil") { viewModel.makeNameNil() } if let name = viewModel.name { ChildView(selectedName: .constant(name)) } } .padding() } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’23
Reply to Sending data between Mac app and iPhone companion app
You will have to explore using Bluetooth.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’23
Reply to Locked out of my bank: needing iOS 13
The iPhone 6 is no longer supported in terms of the latest OS. If price is a concern, the cheapest model I recommend purchasing, renting or taking out on a phone plan is an iPhone SE 2nd edition.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
May ’23
Reply to Get list of all available WiFi networks on iOS
You can't unless you have a business case to backup your request to apple developer for an entitlement.
Replies
Boosts
Views
Activity
May ’23
Reply to Delay in coredata fetch request on substring search
Is the description attribute index full text? https://developer.apple.com/news/?id=kbcw3mst
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
May ’23
Reply to 12 core M2 mini only using 4 cores, Intel Mac mini used 6
The OS will determine if all 12 are needed. What is happening - in your case, all 12 cores are being used proportionately at 33.3% each. http_s://eclecticlight.co/2022/02/24/cpu-percentage-is-misleading-on-m1-macs/
Replies
Boosts
Views
Activity
May ’23
Reply to Crash on AppStore with SwiftUI for iOS 16.4 with "KitRendererCommon(_:) + 176"
Do you have anything special at lines 10 that can be causing the problem, only meant for debug mode or a specific platform version ?-> ProbabilityDistributionsApp.swift:10
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’23
Reply to Using swift or other tool to tell if printer is connected and ready for prints
This will only be true or false if a printer is defined and available and the NSPrinter.printerNames list is non-empty. func isConnectedToPrinter() -> Bool { let printers = NSPrinter.printerNames return !printers.isEmpty } see this GitHub resource on how to query the info you're seeking. https://github.com/marc-medley/004.42Apple_CorePrintingExample/blob/3481a1c8c253f98bbff19741a13cd2c9b8d1d88b/PDFPagePrinter/PDFPagePrinter/PrintData.swift#LL190C9-L203C10 // Printer State var printerState: PMPrinterState = 0 let _ = PMPrinterGetState(pmPrinter, &printerState) d["printerState"] = printerState switch printerState { case UInt16(kPMPrinterIdle) : d["printerStateName"] = "kPMPrinterIdle" case UInt16(kPMPrinterProcessing) : d["printerStateName"] = "kPMPrinterProcessing" case UInt16(kPMPrinterStopped) : d["printerStateName"] = "kPMPrinterStopped" default: d["printerStateName"] = "UNSPECIFIED" } Sean
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
May ’23
Reply to genstrings doesn't include String(localized:)
Not sure why you will automate something like this during a CI phase outside of any development and developer quality checks for any layout issues before release.
Replies
Boosts
Views
Activity
Jun ’23
Reply to Precision issue with 'Double' data type in Swift
Here you go: let a = 9.495 let b = 0.2 let result = a + b let formatted = String(format: "%0.3f", result) if localization of the numbers are required then make use of the locale parameter: let formatted = String(format: "%0.3f", locale: Locale.current, result) Sean!
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’23