Post

Replies

Boosts

Views

Activity

Reply to Can I detect wifi status on/off in iOS
Reachability is deprecated. You can use NWPathMonitors to monitor the WiFi and Cellular connections. A closure is called every time the connection status changes. (The monitoring takes place on a background thread, so you need to dispatch the UI updates on the main thread.) Setup: import NetworkExtension private let monitorWiFi = NWPathMonitor(requiredInterfaceType: .wifi) Monitor: monitorWiFi.pathUpdateHandler = { path in /// This closure is called every time the connection status changes DispatchQueue.main.async { switch path.status { case .satisfied: print("PathMonitor WiFi satisfied, interface: \(path.availableInterfaces) gateways: \(path.gateways)") default: print("PathMonitor WiFi not satisfied: \(path.unsatisfiedReason)") } } } monitorWiFi.start(queue: DispatchQueue(label: "monitorWiFi"))
Jul ’21
Reply to Initializing a @StateObject from an @EnvironmentObject
Yes, this seems clumsy at the moment. As noted, the environmentObject is not available in init. It is possible to assign a temporary value on declaration: @State private var vm: NewsViewModel = /// some temporary value ...then assign the true value in onAppear: .onAppear { vm = /// it's true value, which can reference the environmentObject } It's not pretty, but it works.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’21
Reply to Char comparison not working
The point being that "a" is not equal to "A"... your test for equality must match the letter case. For better readability, you could try: func wordChained() -> Bool{         if let char1 = prevWord.last?.lowercased(),            let char2 = playerWord.first?.lowercased(),            char1 == char2 {             return true         }         return false     }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’21
Reply to SwiftUI Toggle multiple times per frame
Your UI should reflect the state of the PSU. You need to separate out: • A user action sends a command to the PSU. • The app displays the updated PSU state, whenever it is received. Since the PSU can also be switched off (or even on?) outside of the app, you also need to take account of that. That could be achieved (for example) by making the PSU an ObservableObject, and making isOn Published.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’21
Reply to {"timestamp":"2021-07-25 00:49:22.26 -0400","bug_type":"120","os_version":"iPhone OS 12.5 (16H20)","incident_id":"A578AE22-A196-4EB0-A766-33FE1C017FCC"} {"bug_type":"120","os_version":"iPhone OS 12.5 (16H20)"} Incident Identifier: 2684C217-5BBE-43BE-
This is json, so it's easier to read if you lay it out more neatly... { "timestamp":"2021-07-25 00:49:22.26 -0400", "bug_type":"120", "os_version":"iPhone OS 12.5 (16H20)", "incident_id":"A578AE22-A196-4EB0-A766-33FE1C017FCC" } { "bug_type":"120", "os_version":"iPhone OS 12.5 (16H20)" } Incident Identifier: 2684C217-5BBE-43BE- (You seem to have cut it off at this point?) So you have: timestamp: date/time using ISO 8601 format. bug_type: Int. os_version: String. incident_id: UUID.
Jul ’21
Reply to Editor placeholder in source file
newText is an Optional String, so you need to unwrap it, or provide a default value. Maybe... textFieldStrings[index] = newText ?? "some default value" Other than that, you are using several variables where you don't show the declarations. So there could be a problem with one of those?
Topic: UI Frameworks SubTopic: UIKit Tags:
Jul ’21
Reply to UICollectionView Layout Error: nil layout parameter
You haven't shown where centerXAnchor (or the other Anchors) come from. Is it possible that one of them is nil?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Implementing CloudKit in macOS application
This message isn't related to a capability. As it says, you must publish your changes on the main thread.... ...try using (for example): DispatchQueue.main.async { // your publishing code here... } Or for Combine: .receive(on: DispatchQueue.main)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’21
Reply to CloudKit Console: Field 'recordName' is not marked queryable
...
Replies
Boosts
Views
Activity
Jul ’21
Reply to CloudKit Console: Field 'recordName' is not marked queryable
From your second screenshot: Edit Indexes... Add index... Choose the field you want to query by (e.g. recordID) Index type: Queryable
Replies
Boosts
Views
Activity
Jul ’21
Reply to Adding a border to a menu
There doesn't seem to be any way to do this, at the moment.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Can I detect wifi status on/off in iOS
Reachability is deprecated. You can use NWPathMonitors to monitor the WiFi and Cellular connections. A closure is called every time the connection status changes. (The monitoring takes place on a background thread, so you need to dispatch the UI updates on the main thread.) Setup: import NetworkExtension private let monitorWiFi = NWPathMonitor(requiredInterfaceType: .wifi) Monitor: monitorWiFi.pathUpdateHandler = { path in /// This closure is called every time the connection status changes DispatchQueue.main.async { switch path.status { case .satisfied: print("PathMonitor WiFi satisfied, interface: \(path.availableInterfaces) gateways: \(path.gateways)") default: print("PathMonitor WiFi not satisfied: \(path.unsatisfiedReason)") } } } monitorWiFi.start(queue: DispatchQueue(label: "monitorWiFi"))
Replies
Boosts
Views
Activity
Jul ’21
Reply to Initializing a @StateObject from an @EnvironmentObject
Yes, this seems clumsy at the moment. As noted, the environmentObject is not available in init. It is possible to assign a temporary value on declaration: @State private var vm: NewsViewModel = /// some temporary value ...then assign the true value in onAppear: .onAppear { vm = /// it's true value, which can reference the environmentObject } It's not pretty, but it works.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Space bar in Books
You need to use a "hard space" (also called a "non-breaking space"). In Apple Pages, insert a hard space using the key combination Option–Space
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Char comparison not working
The point being that "a" is not equal to "A"... your test for equality must match the letter case. For better readability, you could try: func wordChained() -> Bool{         if let char1 = prevWord.last?.lowercased(),            let char2 = playerWord.first?.lowercased(),            char1 == char2 {             return true         }         return false     }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to SwiftUI Toggle multiple times per frame
Your UI should reflect the state of the PSU. You need to separate out: • A user action sends a command to the PSU. • The app displays the updated PSU state, whenever it is received. Since the PSU can also be switched off (or even on?) outside of the app, you also need to take account of that. That could be achieved (for example) by making the PSU an ObservableObject, and making isOn Published.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to remove all references to the developer process from your app and its metadata
Open the app from the Home screen, instead of from TestFlight.
Replies
Boosts
Views
Activity
Jul ’21
Reply to {"timestamp":"2021-07-25 00:49:22.26 -0400","bug_type":"120","os_version":"iPhone OS 12.5 (16H20)","incident_id":"A578AE22-A196-4EB0-A766-33FE1C017FCC"} {"bug_type":"120","os_version":"iPhone OS 12.5 (16H20)"} Incident Identifier: 2684C217-5BBE-43BE-
This is json, so it's easier to read if you lay it out more neatly... { "timestamp":"2021-07-25 00:49:22.26 -0400", "bug_type":"120", "os_version":"iPhone OS 12.5 (16H20)", "incident_id":"A578AE22-A196-4EB0-A766-33FE1C017FCC" } { "bug_type":"120", "os_version":"iPhone OS 12.5 (16H20)" } Incident Identifier: 2684C217-5BBE-43BE- (You seem to have cut it off at this point?) So you have: timestamp: date/time using ISO 8601 format. bug_type: Int. os_version: String. incident_id: UUID.
Replies
Boosts
Views
Activity
Jul ’21
Reply to Unmatched parens in Archive process generated file
It looks like you have added a "Run Script" Build Phase. Your updated line 2 looks correct, and works for me. However, you could try this for line 2: buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PRODUCT_SETTINGS_PATH}") You could also try deleting the Run Script, and re-adding it.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Editor placeholder in source file
newText is an Optional String, so you need to unwrap it, or provide a default value. Maybe... textFieldStrings[index] = newText ?? "some default value" Other than that, you are using several variables where you don't show the declarations. So there could be a problem with one of those?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to SwiftUI Button: Inaccurate tap area. How should I fix it?
You may be looking at the mouse pointer? Look at the circle (which represents a finger) instead. The tap area is clearly intersecting the button. And of course, this is the simulator. Have you found a problem when running on actual devices?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’21