LAST CHANCE: Save 50% on all my Swift books and bundles! >>

Ultimate Portfolio App Issue Custom sorting for items

Forums > SwiftUI

Hi Guys, code has been followed step by step and for some reason the sorting button on pressing just flips out and goes to the home screen when presenting the ActionSheet (however in the swiftUI simulator its working as expected) anyone else seen this? the action sheet works just have to go back in projects.... which shouldbt be happening....weird

Toobar where the action sheet is

                ToolbarItem(placement: .navigationBarTrailing) {
                    if showClosedProjects == false {
                        Button {
                            withAnimation {
                                let project = Project(context: managedObjectContext)
                                project.closed = false
                                project.creationDate = Date()
                        } label: {
                            Label("Add Project", systemImage: "plus")

                ToolbarItem(placement: .navigationBarLeading) {
                    Button {
                    } label: {
                        Label("Sort", systemImage: "arrow.up.arrow.down")
            .actionSheet(isPresented: $showingSortOrder) {
                ActionSheet(title: Text("Sort items"), message: nil, buttons: [
                    .default(Text("Optimized")) { sortOrder = .optimized },
                    .default(Text("Creation Date")) { sortOrder = .creationDate },
                    .default(Text("Title")) { sortOrder = .title }

all looks fine to me :-(


I think this may be the same problem I was having - see

According to Paul Hudson it's a SwiftUI bug that's fixed in Xcode 12.5 / iOS 14.5. I installed the Xcode 12.5 beta and the problem went away.




Click here to save 50% on all my books and bundles!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.