In my project I had made the following code block
I changed //ToolbarItemGroup(placement: .topBarTrailing)
to ToolbarItemGroup(placement: .topBarLeading)
because I got a compile error. Then I started having the effect of everytime I did a Clean then Rebuild I would get the following Error
/Users/barrywest/Desktop/Apple Development/AppleTutorials/APAJSONReader/APAJSONReader/View/SchemaMaintenance/SchemaDetail.swift:149:42 'navigationBarTrailing' is unavailable in macOS
once clicked it would hightlight the commeted out code. then the error would magically go away after clicking on the error
If you do not click the error it would stay, even if you ran the code it would
display but the simulator would run instead of getting an error
I then delete the comment, but I still get the ghost complile error with the same effect.
I continued to make changes, and now the I get a different older display on the simulator, as compared to my Preivew Display. The colors seem to have gotten saved in the Run Simulator, even after Clean Build, Recompile...
I still get the ghost error which has been removed and the new Executable still contains ghost code which shows incorrect colors.
I can have the simulator and preview view running at the same time with different View Colors...
I have closed the project and reopend the project with no Changes.
My guess is some kind of file corruption somewhere ...
import SwiftUI
import SwiftData
struct SchemaDetail: View {
@Environment(\.modelContext) var dbContext
...
var body: some View {
VStack {
switch schemaName {
case .leagues:
switch displayCategory {
case .full:
leagueFullDisplay
case .brief:
leagueBriefDisplay
case .edit:
leagueEdit
case .create:
leagueCreate
}
...
}
//Text(schemaName.localizedName)
}
.navigationTitle(schemaName.localizedName)
.toolbar {
** //ToolbarItemGroup(placement: .topBarTrailing)**
ToolbarItemGroup(placement: .topBarLeading)
{
switch displayCategory {
case .full:
Button(action: {
}, label: {
Image(systemName: "minus.magnifyingglass")
})
Button(action: {
}, label: {
Image(systemName: "doc.badge.plus")
})
Button(action: {
// Preload from json Warning may be about using background thread ???
Task(priority: .background) {
loadLeagues()
}
}, label: {
Image(systemName: "folder.fill.badge.gearshape")
})
case .brief:
Button(action: {
}, label: {
Image(systemName: "plus.magnifyingglass")
})
Button(action: {
}, label: {
Image(systemName: "doc.badge.plus")
})
case .create:
Button(action: {
}, label: {
Image(systemName: "square.and.arrow.down.fill")
})
Button(action: {
}, label: {
Image(systemName: "arrowshape.turn.up.backward.circle.fill")
})
case .edit:
Button(action: {
}, label: {
Image(systemName: "square.and.arrow.down.fill")
})
Button(action: {
}, label: {
Image(systemName: "arrowshape.turn.up.backward.circle.fill")
})
}
}
}
}
}
#Preview {
SchemaDetail(schemaName: LeagueCategory.sessions, displayCategory: DisplayCategory.brief)
}
2
0
823