here is the link to the AutoColorDemo
https://github.com/travelBuf/AutoColorDemo
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
The article Creating a test project says "The forums have a list of websites you can link to." I haven't been able to find this.
I don't understand your test project article. Where do I put my test project? The test project shows the view with the problem header consisting of 5 files. One file has three different forms of the same structure to create the three images above.
The first image with time 9:35 shows a list of transactions sorted by date using List{}. The column headers are displaying in DARK mode with a black stripe, and header items have switched from black to white.
The second image (9:39) changed to a ScrollView {}. The column headers did not change color, but scrolled out of the view. The header is showing that the text has changed from black to white while scrolling.
The final image is a ScrollView with LazyVStack pinnedViews. Google suggested using .toolbarColorScheme(.light, for: .navigationBar) at the bottom of the ScrollView to prevent the header stuff from changing color.
So my question is: Is this change in color for these views a bug or is this normal behavior with Liquid Glass?
After considerable review of the Done button operation, I noticed that I could get the button to reappear by selecting another tab and then returning to the expense entry tab.
I added some breakpoints and noticed that some of the state parameters were not getting reset upon saving the data.
Finally, I moved the state parameter reset logic outside the getLocation closure and this appears to have fixed the state parameters for the next entry and the Done button. The weird Done button behavior is no longer occurring!
func saveButton() {
if moneyD == 0.0 {
zeroEntry = true
} else {
withAnimation {
// get coordinates and address
getLocation { addr in
self.addr = addr
// address
if let city = addr.locality {
entryLocCity = city
}
if let state = addr.administrativeArea {
entryLocState = state
}
if let countryL = addr.countryL {
entryLocCountryL = countryL
}
if let countryS = addr.countryS {
entryLocCountryS = countryS
}
guard let moneyD else { return }
let moneyH = categories.saveCategoryTotal(entryCat: self.entryCat, rate: rate, moneyD: moneyD)
modelContext.insert(TravelEntries(
id: UUID(),
entryDate: entryDT,
...
entryLocCity: entryLocCity,
entryLocState: entryLocState,
entryLocCountryS: entryLocCountryS,
entryLocCountryL: entryLocCountryL
))
dtTotals.addToDailyTotal(gotDate: entryDT, gotTotal: moneyH)
}
// reset parameters for next entry
self.entryDT = Date()
self.entryCat = 0
self.entryPT = 0
self.entryDsc = ""
self.moneyD = nil
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
Searching around the web I found a site showing how to initialize the map view with Map(initialPosition: .region(MKCoordinateRegion(center: span()))
struct DetailPortView: View {
var item: TravelEntries
@Binding var mapType: Int
var coordinate: CLLocationCoordinate2D {
CLLocationCoordinate2D(
latitude: item.entryLat,
longitude: item.entryLong
)
}
var selectedMapStyle: MapStyle {
return switch(mapType) {
case 0: .standard(elevation: .realistic)
case 1: .hybrid(elevation: .realistic)
case 2: .imagery(elevation: .realistic)
default: .standard(elevation: .realistic)
}
}
var body: some View {
VStack {
Map(initialPosition: .region(MKCoordinateRegion(center: coordinate, span: (MKCoordinateSpan(latitudeDelta: 0.005, longitudeDelta: 0.005))))) {
Marker("\(item.entryCatName ?? "") purchase", coordinate: coordinate)
.tint(.red)
}
.mapStyle(selectedMapStyle)
ShowMapPicker(item: item, mapType: $mapType)
ShowDetails(item: item)
}
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
I have discovered that if I add a .safeAreaInset containing a button I can then add a camera region with latitudeMeters / longitudeMeters (span):
.safeAreaInset(edge: .bottom) {
Button {
camera = .region(MKCoordinateRegion(center: coordinate, latitudinalMeters: 750, longitudinalMeters: 750))
} label: {
Text("Button")
}
But I don't want the user to have to hit another button for the span to get set properly. Any ideas on how to do that?
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
3rd paragraph correction: ...but that doesn't seem to be working here.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
Searching the web I found that I can use:
let Tz = TimeZone.current.identifier or let Tz = TimeZone.current.abbreviation()
to get the current timezone. How do I apply this to the displayed date/time?
Topic:
Programming Languages
SubTopic:
Swift
Tags:
Thanks MobileTen
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: