Post

Replies

Boosts

Views

Activity

Reply to Validating Signature Of XPC Process
I've just started using xpc_connection_set_peer_code_signing_requirement() and can happily report that it meets all of my needs in terms of validating who my XPC connection is really connected to. However there seems to have been a slight oversight in that the new error XPC_ERROR_PEER_CODE_SIGNING_REQUIREMENT has either not been made public, or is not available to Swift code for some reason. For example: if event === XPC_ERROR_CONNECTION_INVALID { // OK } else if event === XPC_ERROR_TERMINATION_IMMINENT { // OK } else if event === XPC_ERROR_CONNECTION_INTERRUPTED { // OK } else if event === XPC_ERROR_PEER_CODE_SIGNING_REQUIREMENT { // Error: Cannot find in scope }
Oct ’21
Reply to Not getting CloudKit silent push notifications on macOS
So I read through TN2265: Troubleshooting Push Notifications - https://developer.apple.com/library/archive/technotes/tn2265/_index.html#//apple_ref/doc/uid/DTS40010376-CH1-TNTAG24 and it looks like the problem is that APSD never connects to the *development* iCloud environment on macOS because: I get neither the success nor the failure delegate callback when registering for remote notifications apsctl status shows: daemon status:																Running certificate status:													 Provisioned, using existing certificate app refresh activity:												 Yes connection environment:											 development 	 courier status:														Not connected because there are no eligible topics 			enabled:																Yes 			stream connected:											 No 			connected to service:									 No I'm guessing "there are no eligible topics" means "you are not running any apps that connect to the development environment", so perhaps the problem is that it's not noticing that I'm launching my app that wants the dev environment? I'm kinda stuck at this point though because I don't see any documentation on apsctl that would allow me to troubleshoot further.
Jan ’21
Reply to Animating popover size changes
Sorry, here is an example. Paste this into a new macOS swiftUI project and do a live preview to see what I mean. import SwiftUI struct ContentView: View {     @State var isPopped = false     var body: some View {         Button("Popover") {             isPopped = true         }         .popover(isPresented: $isPopped, content: {             MyPopover()         })         .padding()     } } struct MyPopover: View {     @State var moreControls = false     var body: some View {         Form {             Text("Text")             Button("Toggle") {                 withAnimation {                     moreControls.toggle()                 }             }             if moreControls {                 Text("More Controls")             }         }         .padding()     } }
Nov ’20
Reply to SwiftUI multi platform incompatibilities
I'm a swiftUI newbie, but so far my experience has been that your cross-platform swiftUI views will be full of #if os(...) And for modifiers, I guess you have to do something like this, which makes it even more annoying /// Workaround since .collapsible isn't available on iOS and there's no way to #if out the modifier function directly extension Section where Parent: View, Content: View, Footer: View {     func noCollapseIOSCompat() -> some View {         #if os(macOS)         return self.collapsible(false)         #else         return self         #endif     } }
Jul ’20
Reply to Missing/Broken features in SwiftUI [List]
Looks like just about anything inside a sheet on macOS doesn't layout correctly. For example: .sheet(...) { 		 NavigationView {             Form {                 Section() {                     TextField("Name", text: $name)                 }                 Section(header: Text("Title")) {                         TextField("Address", text: $address)           								}        			}       }.navigationTitle("New Item") } Looks great on iOS but on macOS has clipped controls, incorrect margines, sections running together with no/incorrect padding, etc.
Jul ’20
Reply to Xcode 12 can't add package dependency from ssh?
Ok I had some more time to experiment. It looks like the package repository must have a branch called "master" for this to work. If the main branch in the package you're trying to import is called anything else, like "trunk" or "main" for example, adding the dependency will fail. This is particularly bad because creating a new package in Xcode (File -> New -> Swift Package...) creates a git repo with a branch called "main", not "master"!
Jul ’20
Reply to When is DispatchIO cleanup handler called?
Well, my actual situation is more complicated. I'm creating mutiple channels from the same FD, and each channel has some channel-specific cleanup code that needs to run when it's finished. The final cleanup of the FD happens much later. This is not an insurmountable problem, obviously I could manually call the channel-specific cleanup code when I close the channel, however it would be a lot more convenient and better factored if it was encapsualted in the cleanupHandler and worked like the documentation says.
Jun ’20
Reply to When is DispatchIO cleanup handler called?
Regarding programming errors, the documentation specifically states (emphasis mine):"The channel takes control of the specified file descriptor until the channel closes ... It is a programmer error for you to modify the file descriptor while the channel owns it."So this sounds like after I call channel.close() it is ok for me to close the underlying file descriptor. This is the scneario in which my cleanup handler is called. I close the channel, then I close the file descriptor, then my cleanup handler is enqueued. If I don't close the FD, I get no cleanup.Your point about DispatchIO code spiraling out of control is well noted. I'm not too far along on this part of the project, but so far everything has been working as I expected, except for the cleanup handlers, however if weird behavior like this keeps cropping up I'll be prepared to go with a different solution. The key feature that drove me to DispatchIO in the first place is large (100's of MB) asynchronous, cancellable, streaming read operations. I'm definitely open to other suggestions.
Jun ’20