This is probably abusing the system more than it should be but maybe it is somehow possible. I have:
An objective-C based storyboard iPad OS app. I'm beginning to adopt SwiftUI.
I have a hosting controller with a content view that has a lazygrid of cards, which have an NSManagedObject for data. On tapping a card, a detail view opens, if in multi-tasking, a new window, if not, pushing the navigation controller (this detail view still exists in UIKit/ObjC, and is handled by sending a notification with the ObjectID, which then triggers a storyboard segue to the detail.)
I have zoom transitions on all my things. They work great in Obj.C, especially now with the bar button source.
On my iPhone target, I still have an old tableview, and I'm able to zoom properly - if someone changes the detail view's managed object (through a history menu), the zoom context looks up where the tableview is, and scrolls to it while popping.
I'd like to somehow do this on the lazygrid - first) to just have an individual card be the zoom source, it should be able to know what the source view is to say in the prepareForSegue method just to zoom at all. and second) if the detail has changed the current ObjectID (which gets passed around as a notification), to somehow scroll the lazygrid to the right object before popping.
I've looked at https://developer.apple.com/tutorials/SwiftUI/interfacing-with-uikit but this seems like swiftUI is the host. I have it the other way around, uikit hosting swiftUI pushing uikit.
TIA for any pointers
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I'm trying to piece together how I should reason about multiple windows, activating menus and items.
For instance, I have an email command. If a document is open, it emails just that document. If the collection view holding that document is open, it generates an attachment representing the collection. (this happens with buttons right now but this really feels like a menu item) How do I tell which window is active (document/collection) in order to have the right menu item available.
If the user is adding a document I don't want the "new" command open, I only want one editing view. I saw sample code to include or remove commands but not disable them. I feel like there's a whole conceptual layer I want to understand with the interplay with scenes but don't know where to look for documentation. I searched here but there's hardly any threads on this.
TIA
Topic:
UI Frameworks
SubTopic:
UIKit
Woke up to see my table gone. Whoa. What happened. FB19400940
Commenting this line in viewDidLoad or changing to softStyle brings it back.
[self.tableView.topEdgeEffect setStyle:[UIScrollEdgeEffectStyle hardStyle]];
Videos in attached fb.
I want a different color, one from my asset catalog, as the background of my first ever swift UI view (and, well, swift, the rest of the app is still obj.c)
I've tried putting the color everywhere, but it does't take. I tried with just .red, too to make sure it wasn't me. Does anyone know where I can put a color call that will actually run? Black looks very out of place in my happy app. I spent a lot of time making a custom dark palette.
TIA
KT
@State private var viewModel = ViewModel()
@State private var showAddSheet = false
var body: some View {
ZStack {
Color.myCuteBg
.ignoresSafeArea(.all)
NavigationStack {
content
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .principal) {
Image("cute.image")
.font(.system(size: 30))
.foregroundColor(.beigeTitle)
}
}
}
.background(Color.myCuteBg)
.presentationBackground(.myCuteBg)
.sheet(isPresented: $showAddSheet) {
AddView()
}
.environment(viewModel)
.onAppear {
viewModel.fetchStuff()
}
}
.tint(.cuteColor)
}
@ViewBuilder var content: some View {
if viewModel.list.isEmpty && viewModel.anotherlist.isEmpty {
ContentUnavailableView(
"No Content",
image: "stop",
description: Text("Add something here by tapping the + button.")
)
} else {
contentList
}
}
var contentList: some View {
blah blah blah
}
}
First I tried the background, then the presentation background, and finally the Zstack. I hope this is fixed because it's actually fun to build scrollable content and text with swiftUI and I'd been avoiding it for years.
Anyone know how to get Xcode cloud build crashes desymbolicated? I have a crash in organizer, and there seems to be no way to associate the remote build with the DSYM.
I have a build made through Xcode cloud. I can download artifacts. TBH it's been a while since I've gone fishing for dsyms in an xcarchive but I found one.
Am I missing something?
So.... I'm touching a project I haven't looked at in 7 months, which was an attempt to use CloudKit CoreData and Diffable Data Sources with a split view controller from the template. I'm running it on latest everything now and it is causing an infinite loop in the saving context part of InsertNewObject, and the FetchResult Controller delegate update snapshot. It keeps adding tableviewcells.
Yes I'm still using Objective C. I thought it would be interesting to try to make everything work with the new Diffable Data Source. I tried deleting all CloudKit records and that didn't help. Not sure what has changed in the last 7 months but I'm pretty sure the project worked the last time I touched it.
Here's the code - it's looping somewhere in the bold section:
(void)insertNewObject:(id)sender {
NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext];
TaskCategory *newTaskCategory = [[TaskCategory alloc] initWithContext:context];
// If appropriate, configure the new managed object.
newTaskCategory.uniqueID = [NSUUID UUID];
newTaskCategory.orderInSection = [[self.fetchedResultsController sections] count];
newTaskCategory.categoryName = @"";
Task *newTask = [[Task alloc]initWithContext:context];
newTask.uniqueID = [NSUUID UUID];
newTask.orderInSection = 0;
newTask.taskName = @"";
newTask.pointValue = 1;
[newTaskCategory addTasksObject:newTask];
// Save the context.
NSError *error = nil;
if(![context obtainPermanentIDsForObjects:@[newTask, newTaskCategory] error:&error]){
NSLog(@"Unresolved error %@, %@", error, error.userInfo);
abort();
}
if (![context save:&error]) {
// Replace this implementation with code to handle the error appropriately.
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
NSLog(@"Unresolved error %@, %@", error, error.userInfo);
abort();
}
}
(void)controller:(NSFetchedResultsController *)controller didChangeContentWithSnapshot:(NSDiffableDataSourceSnapshot<NSString *,NSManagedObjectID *> *)snapshot
{
if (self.masterTableView.window)
{
[self.tableData applySnapshot:snapshot animatingDifferences:YES];
}
}
The only thing logging at this time is CloudKit stuff:
CoreData: debug: CoreData+CloudKit: -[NSCloudKitMirroringDelegate managedObjectContextSaved:](2092): <NSCloudKitMirroringDelegate: 0x600003c94c30>: Observed context save: <NSPersistentStoreCoordinator: 0x600002cd7db0> - <NSManagedObjectContext: 0x600003c94d00>
CoreData: CloudKit: CoreData+CloudKit: -[PFCloudKitExporter exportIfNecessary]_block_invoke_2(153): <PFCloudKitExporter: 0x6000024ec870>: Found 0 objects needing export.
CoreData: debug: CoreData+CloudKit: -[NSCloudKitMirroringDelegate managedObjectContextSaved:](2092): <NSCloudKitMirroringDelegate: 0x600003c94c30>: Observed context save: <NSPersistentStoreCoordinator: 0x600002cd7db0> - <NSManagedObjectContext: 0x600003cca490>
CoreData: warning: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _exportFinishedWithResult:exporter:](1161): Finished export: <PFCloudKitExporter: 0x6000024ec870>
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _finishedRequest:withResult:](2483): Finished request: <NSCloudKitMirroringExportRequest: 0x6000009a2100> 0A0EEAA5-54E0-41BE-8C89-5FFB1A3CD045 with result: <NSCloudKitMirroringResult: 0x6000007fa3c0> success: 1 madeChanges: 0 error: (null)
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _scheduleAutomatedExportWithLabel:activity:completionHandler:]_block_invoke(2581): <NSCloudKitMirroringDelegate: 0x600003c94c30> - Finished automatic export - ExportActivity - with result: <NSCloudKitMirroringResult: 0x6000007fa3c0> success: 1 madeChanges: 0 error: (null)
CoreData: warning: CoreData+CloudKit: -[NSCloudKitMirroringDelegate finishedAutomatedRequestWithResult:](2496): Finished request '<NSCloudKitMirroringExportRequest: 0x6000009a2100> 0A0EEAA5-54E0-41BE-8C89-5FFB1A3CD045' with result: <NSCloudKitMirroringResult: 0x6000007fa3c0> success: 1 madeChanges: 0 error: (null)
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate checkAndExecuteNextRequest](2452): <NSCloudKitMirroringDelegate: 0x600003c94c30>: Checking for pending requests.
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate checkAndExecuteNextRequest]_block_invoke(2468): <NSCloudKitMirroringDelegate: 0x600003c94c30>: No more requests to execute.