Post

Replies

Boosts

Views

Activity

Communicating with a non sandboxed process inside the App Sandbox via IPC
A similar form of this question has been asked a few times on this forum, but the answers varied a lot, and things have changed since previous posts.* My application is inside the 'App Sandbox', I want to communicate with another application which is not inside the sandbox at all. The non-sandboxed application has an IPC file which is present in the following location: /var/folders/0x/h5vjdg1s1gb3s__gfr5mmx040000gn/T/discord-ipc-0 cbyrne@Conors-Air in ~ ❯ echo $TMPDIR /var/folders/0x/h5vjdg1s1gb3s__gfr5mmx040000gn/T/ My application can't see that file, and when I try to give it permission to see that file by using the NSOpenPanel dialog, swift-nio is unable to establish a connection to the socket: connect(descriptor:addr:size:): Operation not permitted (errno: 1) However, if I let my app out of the 'App Sandbox': <key>com.apple.security.app-sandbox</key> <false/> It works fine, and my app is able to communicate with the non-sandboxed app. So, can sandboxed apps not communicate with other non-sandboxed apps via IPC at all?
1
0
729
Feb ’22
What is the correct way to share an ObservedObject between 2 views in SwiftUI?
Upon making my multiplatform SwiftUI app - I have encountered an issue when using ObservedObject between 2 views on macOS. When passing an @ObservedObject in one view, to an EnvironmentObject in another this issue occurs only on macOS, iOS works fine When modifying the entries variable, the array is updated as expected This was verified by logging the addEntry and removeEntry calls The sidebar containing the list however, doesn't update it's content My app synchronizes this array with UserDefaults, after restarting the app the change is visible Is this a bug, or am I doing something incorrectly? I believe iOS is working because of the way the view is 'reloaded' when it comes back into view? - I'm really not sure. Any help is appreciated! My code is here: struct EditView: View {     @EnvironmentObject var settings: Settings     @Environment(\.presentationMode) var presentationMode: Binding&lt;PresentationMode&gt;     var entry: ListEntry     var body: some View {         VStack {             HStack {                 Image(systemName: "circle.fill")                 Text(entry.content)             }             .frame(minWidth: 0, maxWidth: .infinity, alignment: .center)             .padding()             Spacer()             Button("Delete Entry") {                 settings.removeEntry(entry)                 presentationMode.wrappedValue.dismiss()             }.padding()         }         .navigationTitle("Edit Entry")     } } struct ContentView: View {     @ObservedObject var settings: Settings = Settings.shared     var body: some View {         NavigationView {             List {                 ForEach(settings.entries) { entry in                     NavigationLink(destination: EditView(entry: entry).environmentObject(settings)) {                         HStack {                             Image(systemName: "circle.fill")                             Text(entry.content)                         }                         .padding([.leading, .trailing])                         .padding([.top, .bottom], 10)                     }                 }             }             .navigationTitle("Clipper")             .toolbar {                 ToolbarItem(placement: .primaryAction) {                     Button(action: {                         settings.addEntry(ListEntry("Example Entry"))                     }) {                         Image(systemName: "plus.circle")                     }                 }             }         }     } }
4
0
1.3k
Jun ’20
New 'Label' component displaying incorrectly in SwiftUI
When making a Multiplatform app (it could be on all, I've only tested with Multiplatform so far) the Label component in SwiftUI doesn't display correctly. I would share a screenshot but: The forums doesn't seem to support uploading of images When I try to attach a link to imgur, it says I have to remove the link. Since I can't share a screenshot, I will do my best to describe it: The SF Symbol appears raised compared to the text, almost like there's not enough room for the symbol My Code: List(items, id:\.self) { item in &#9;&#9;NavigationLink(destination: MyView()) {    &#9;&#9; HStack {        &#9;&#9; Label(item, systemImage: "circle")         }     } } Is this a known issue, if not: where should I report it?
3
0
525
Jun ’20
WidgetKit crash on iOS Simulator
I'm trying to add a widget to my SwiftUI Application. I've made a Widget Extension in my App. Upon running the target in the simulator, this error appears in the console: ClipperWidgetExtension[7343:594354] Fatal error: PlatformViewRepresentableAdaptor&lt;ListRepresentable<SystemListDataSource<Never&gt;, SelectionManagerBox&lt;Never&gt;>>: file /Library/Caches/com.apple.xbs/Sources/Chrono_Sim/Chrono-63.5/WidgetKit/SPI/WidgetViewArchive.swift, line 254 The line that Xcode brings my attention to is this: completion(Timeline(entries: [SimpleEntry()], policy: .never)) The whole code for my timeline provider and entry: struct Provider: TimelineProvider {     public typealias Entry = SimpleEntry     public func snapshot(with context: Context, completion: @escaping (SimpleEntry) -> ()) {         let entry = SimpleEntry()         completion(entry)     }     public func timeline(with context: Context, completion: @escaping (Timeline&lt;Entry&gt;) -> ()) {         completion(Timeline(entries: [SimpleEntry()], policy: .never))     } } struct SimpleEntry: TimelineEntry {     var date: Date = Date() } Any help would be appreciated :)
2
1
1.9k
Jun ’20