Posts

Post not yet marked as solved
1 Replies
709 Views
I have an AppKit app written mostly in Objective-C. I'm trying to convert my NSOutlineView to a SwiftUI OutlineGroup. Right now I'm just using List{} because I can't get OutlineGroup to work with CoreData. But when I display my list of items in the sidebar, I can't select any items. I can click on them of course, but the row selection highlighting doesn't work at all. I think maybe this might have something to do with the fact that my SwiftUI view is embedded within an NSHostingView. I've setup my NSHostingView like this: import Cocoa import SwiftUI @objc class FormsListHostingController: NSViewController { public var viewModel : FormsListUIView.ViewModel? var formsListView : FormsListUIView? @objc public var databaseDocument : TFDatabaseDocument? override func viewDidLoad() {         super.viewDidLoad() var hostingView : NSHostingView<FormsListUIView>? if let context = self.databaseDocument?.dataAccessManager?.persistentContainer.viewContext { let viewModel = FormsListUIView.ViewModel(managedObjectContext: context) let contentView : FormsListUIView = FormsListUIView(viewModel: viewModel) hostingView = NSHostingView(rootView: contentView) self.view = hostingView! } } } and my SwiftUI view is setup like this: struct FormsListUIView: View { @Environment(\.managedObjectContext) var context @ObservedObject var viewModel: ViewModel @State private var selection: CDForm? = nil @State private var isSelected : Bool = false var body: some View { List(selection: self.$selection) { ForEach(viewModel.categories, id: \.uuid) { (category : CDCategory) in Section(header: Text(category.name ?? "").font(.headline)) { ForEach(Array(category.forms as! Set<CDForm>), id: \.uuid) { (form : CDForm) in FormRow(form: form).onTapGesture { self.selection = form isSelected.toggle() } } } } } .listStyle(SidebarListStyle()) .frame(maxWidth: .infinity, maxHeight: .infinity) } } Any ideas why the row selection doesn't show? I'm suspecting it's a problem with showing a SwiftUI view within an NSHostingView.
Posted
by TapZapp.
Last updated
.
Post not yet marked as solved
1 Replies
761 Views
I am getting the following error when trying to save a Core Data entity on iOS 15 for a Binary Data property that's marked as Allows External Storage. NSDestinationFilePath=/private/var/mobile/Containers/Data/Application/84AF234B-E720-4DD5-96F5-4D9FE9EC374C/tmp/.LINKS/6BD575C1-FF6F-4F7E-A3A5-DF334B4219F8/F0FFA46B-6A17-4783-8935-8EF20509B990_0x2825aea80, NSFilePath=/private/var/mobile/Containers/Data/Application/84AF234B-E720-4DD5-96F5-4D9FE9EC374C/Documents/Test Photos.tapforms/db-ebd84a251706462fb4df5308b3cbdd1c.cd/.tf6_SUPPORT/_EXTERNAL_DATA/F0FFA46B-6A17-4783-8935-8EF20509B990.interim, NSUnderlyingError=0x2816b9bf0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}} So it would seem perhaps that Core Data is writing an interim file probably in an atomic way and may be trying to rename it afterwards. But it's not finding the .interim file and is throwing this error. Does anyone know a solution to this problem? Thanks, Brendan
Posted
by TapZapp.
Last updated
.
Post not yet marked as solved
1 Replies
710 Views
When taking a photo in my app using the camera source, didFinishPickingMediaWithInfo will return a UIImage that is rotated. But only if the image was captured in portrait orientation. Landscape images come out perfect.This is a new behaviour as it worked just fine in iOS 12 and prior.The UIImage's imageOrientation comes out as UIImageOrientationRightIf I first save the image into the Photo Library and then select the image, then didFinishPickingMediaWithInfo returns the correctly oriented portrait image.Why would there be a discrepancy like this and how do I overcome it?Is this just the new behaviour of iOS 13 or is this a bug?
Posted
by TapZapp.
Last updated
.