Posts

Post not yet marked as solved
0 Replies
528 Views
App with 3 split view using Navigation view. This on an iPhone automatically becomes stacked navigation style. so drilling down into detail views ... will have the normal transition animations of pushing and popping views. But these transitions are not working on iOS 14.5 RC /Xcode 12.5RC . Now tapping on a master...the detail appears without the push transition animation :( Same code works just fine on stable versions of iOS 14.4 and Xcode with the push/pop transition animations. Not sure what changed but any workarounds to restore these transitions on iPhone?
Posted Last updated
.
Post not yet marked as solved
5 Replies
770 Views
In UIKit, I believe we can check if the split view controller primary view is in collapsed state...but can't figure out a way to check if the primary view is collapsed in SwiftUI I tried using the horizontalSizeClass == .regular check in the secondary view...but it is always .regular for the secondary view on an iPad. Any pointers will be deeply appreciated
Posted Last updated
.
Post not yet marked as solved
0 Replies
1.2k Views
Trying to save a custom type using @SceneStorage. Here is what I did...please see sample code below made the custom type RawRepresentable conformant marked it Codable Everything seems to work fine...but when the App goes to background...as expected ... block is executed... var rawValue: RawValue { .... crashes .... } and **JSONEncoder.encode(self). seems to go recursive and crash into a EXCMEMACCESS, code: 2... Any pointers are deeply appreciated ! struct AppUIState: RawRepresentable, Codable {    typealias RawValue = String    var enteredText: String?  static let empty = """                         {                            "enteredText": ""                          }                      """    init() { }    init?(rawValue: RawValue) {         guard let data = rawValue.data(using: .utf8), let result = try? JSONDecoder().decode(AppUIState.self, from: data) else { return nil }        self = result    }   var rawValue: RawValue {       debugPrint("var rawValue: self: \(self)")         /* ===== 👇 exc mem access crash after .encode(self) executed... seems to go recursive  ======*/         guard let data = try? JSONEncoder().encode(self), let stringResult = String(data: data, encoding: .utf8) else { return Self.empty }        return stringResult     } } /* View */ ContentView:	View {     @SceneStorage("SceneStorage.Keys.appUserState")     var appUIState = AppUIState() ... ... ... ... } code-block
Posted Last updated
.
Post marked as solved
1 Replies
547 Views
Working on a SwiftUI App with hierarchical data displayed in split views (primary, supplementary and secondary views). Since the data is hierarchical across three views, the UI selections that need to be stored in the @SceneStorage is dependent on each other . The primary view user state drives the relevancy of the user state in the supplementary and secondary views. But loading of the Primary view is predicated on a @FetchRequest, which gets constructed before the view self is instantiated, is predicated on the mailboxID stored in the @SceneStorage. Since the @SceneStorage is limited to be used only within a view...how can one send a parameter to the Predicate in the @FetchRequest which is loaded even before the view is instantiated ? I am inclined to believe my understanding is wrong but in reality I am facing this interdependency conflict between @SceneStorage and @FetchRequest Lifecycles :( Note: If I store this attributed are stored in @AppStorage instead of SceneStorage, this is easily resolved because @AppStorage can be invoked to access the parameters even in Non-View classes and hence not tied to view instantiation to be complete. Any suggestions are deeply appreciated?
Posted Last updated
.
Post not yet marked as solved
0 Replies
737 Views
Does CloudKit API allow to enquire default Family members of the account holder and create a default share between them without the users having to manually set it up? Most Apple Native apps (for example: Reminders app) do create a default "Family" share when they initialize the App which is very convenient for users. Apple Developers in WWDC do claim emphatically that they use the same CloudKit API to build iCloud features for Apple native apps like Notes, Reminders. But, maybe I am missing something, I can't find the API in cloudKit that will be provide the info needed to setup a default Family share without hassling the user ... just like the native apps do. Any pointers or clarification is deeply appreciated.
Posted Last updated
.
Post not yet marked as solved
0 Replies
1.2k Views
I have a List in a sidebar style which contains a LazyVGrid and a Section with a simple list contents. Every thing works well except when content increases and layout changes (from two columns to one column) for the LazyVGrid with editMode changing to .active ... LazyVGrid does not expand/resize when the content increases (the increased content gets clipped)...but does when user expands/folds on the section below :(. However LazyVGrid resizes to show the entire content when the content shrinks with editMode reverting to .inactive Note: If I replace the List with a ScrollView...lazyVGrid resizes perfectly when content increases in editMode = .active....but then I would lose all the Sidebar and List characteristics for the Section below :( Also, looks like .onMove is not supported in LazyVGrids Any pointers to solve the LazyVGrid (embedded in a List) not resizing or expanding when content increases ... will be deeply appreciated. var body: some View {         List {             LazyVGrid(columns: editMode?.wrappedValue == .active ? singleColumn : twoColumns, alignment: .leading, spacing: 10) {                 ForEach(editMode?.wrappedValue == .active ? allDashItems : selectedDashItems) { dashitem in                     DashItemCell(dashitem)                                         }                 .onMove(perform: moveDashItem)                 .environment(\.editMode, editMode)             }             Section(header: Text("Bottom Section")) {                     ForEach (sectionList)	{ item in                         ListItemCell(item)                     }                     .onDelete(perform: deleteFolder)                     .onMove(perform: moveFolder)                 }         }         .listStyle(SidebarListStyle()) }
Posted Last updated
.
Post marked as solved
2 Replies
600 Views
Developing a multi platform app using SwiftUI. But soon ran into compile issues on macOS because of EditMode incompatibility on that platform. EditMode is quite intensively used almost in every scene in iOS and also deeply ingrained in modifier calls etc. It is apparent the power and the potential of SwiftUI in developing complex apps and its multi platform support. However I am a bit surprised about the cross-platform cross platform incompatibility of basic facets like EditMode. So surprised that I am questioning myself if I am doing it right. Is there a way to develop cross platform apps using SwiftUI without extensive use of preprocessor directives strewn across "shared" code?
Posted Last updated
.
Post not yet marked as solved
1 Replies
333 Views
Have been trying to create a non-momentary toolbar button which shows selection state (like the toolbar buttons in Calendar App in iOS 14). Looks like there is no direct support for this in SwiftUI framework. Any pointers will be deeply appreciated.
Posted Last updated
.
Post marked as solved
1 Replies
1k Views
I am trying to create an appearance of a "pressed button" state for a Toolbar Button Item using SwiftUI ... just like the Calendar App sidebar toolbar button items in iOS 14. I have tried "inverting" the background and foreground color using a @State bool property - but doesn't seem to have no affect at all. Any help will be greatly appreciated.
Posted Last updated
.
Post not yet marked as solved
0 Replies
478 Views
SwiftUI List(selection: $selections) - How can I enable selections for only particular sections and delete/move for the other sections. There are modifiers for disabling Move and Delete for sections but not Selections which seem to be enabled for all sections when a list with List(selection: ) is used. Any pointers will be deeply appreciated.
Posted Last updated
.
Post not yet marked as solved
2 Replies
903 Views
Working on a swift UI based split view with a sidebar primary view. The sidebar view by itself shows up with Sidebar characteristics just fine. But when the same view is embedded in a navigation view as part of a split view, the primary view appears more like a InsetListStyle ignoring the SidebarListStyle. (code snippet below) Is this standard behavior or a bug? Also, is there a different way to achieve a split view without losing the primary sidebar characteristics? Any pointers are appreciated. Thanks @main struct MyApp: App {     var body: some Scene {         WindowGroup {             NavigationView {                 SidebarContentView()                 SupplementaryContentView()                 SecondaryContentView()             }         } } struct SidebarContentView: View { var model	= [...] var body: some View {         List (model, children: \.children) { item in             SidebarItemView(item: item, selectedItemTag: $selectedItemTag)           }         .listStyle(SidebarListStyle()) }
Posted Last updated
.
Post marked as solved
2 Replies
1.3k Views
lazyVGrid with two columns, is there a way to span the odd last item to span the two columns just to be symmetric🤔. Apple reminders app does exactly that but not sure if they use the LazyVGrid any pointers are very much appreciated.
Posted Last updated
.