This commit is contained in:
John Estropia
2026-07-15 11:50:43 +09:00
parent 7db1cfecfb
commit 890e150b95
135 changed files with 2895 additions and 2526 deletions
@@ -15,18 +15,22 @@ extension Modern.TimeZonesDemo {
// MARK: Internal
init(title: String, subtitle: String) {
self.title = title
self.subtitle = subtitle
}
// MARK: View
var body: some View {
VStack(alignment: .leading) {
Text(self.title)
.font(.headline)
.foregroundColor(.primary)
Text(self.subtitle)
.font(.subheadline)
.foregroundColor(.secondary)
@@ -40,19 +44,3 @@ extension Modern.TimeZonesDemo {
fileprivate let subtitle: String
}
}
#if DEBUG
struct _Demo_Modern_TimeZonesDemo_ItemView_Preview: PreviewProvider {
// MARK: PreviewProvider
static var previews: some View {
Modern.TimeZonesDemo.ItemView(
title: "Item Title",
subtitle: "A subtitle caption for this item"
)
}
}
#endif
@@ -10,7 +10,7 @@ import SwiftUI
extension Modern.TimeZonesDemo {
// MARK: - Modern.TimeZonesDemo.ListView
struct ListView: View {
// MARK: Internal
@@ -53,15 +53,18 @@ extension Modern.TimeZonesDemo {
// MARK: View
var body: some View {
List {
ForEach(self.values, id: \.title) { item in
Modern.TimeZonesDemo.ItemView(
title: item.title,
subtitle: item.subtitle
)
}
}
.navigationBarTitle(self.title)
.navigationTitle(self.title)
}
@@ -71,24 +74,3 @@ extension Modern.TimeZonesDemo {
private let values: [(title: String, subtitle: String)]
}
}
#if DEBUG
struct _Demo_Modern_TimeZonesDemo_ListView_Preview: PreviewProvider {
// MARK: PreviewProvider
static var previews: some View {
Modern.TimeZonesDemo.ListView(
title: "Title",
objects: try! Modern.TimeZonesDemo.dataStack.fetchAll(
From<Modern.TimeZonesDemo.TimeZone>()
.orderBy(.ascending(\.$name))
)
)
}
}
#endif
@@ -10,7 +10,7 @@ import SwiftUI
extension Modern.TimeZonesDemo {
// MARK: - Modern.TimeZonesDemo.MainView
struct MainView: View {
/**
@@ -61,11 +61,11 @@ extension Modern.TimeZonesDemo {
return try! Modern.TimeZonesDemo.dataStack.fetchAll(
From<Modern.TimeZonesDemo.TimeZone>()
.where((-secondsIn3Hours ... secondsIn3Hours) ~= \.$secondsFromGMT)
/// equivalent to:
/// ```
/// .where(\.$secondsFromGMT >= -secondsIn3Hours
/// && \.$secondsFromGMT <= secondsIn3Hours)
/// ```
/// equivalent to:
/// ```
/// .where(\.$secondsFromGMT >= -secondsIn3Hours
/// && \.$secondsFromGMT <= secondsIn3Hours)
/// ```
.orderBy(.ascending(\.$secondsFromGMT))
)
}
@@ -137,36 +137,54 @@ extension Modern.TimeZonesDemo {
// MARK: View
var body: some View {
List {
Section(header: Text("Fetching objects")) {
Section("Fetching objects") {
ForEach(self.fetchingItems, id: \.title) { item in
Menu.ItemView(
title: item.title,
NavigationLink(
destination: {
Modern.TimeZonesDemo.ListView(
title: item.title,
objects: item.objects()
)
},
label: {
Menu.ItemView(
title: item.title
)
}
)
}
}
Section(header: Text("Querying raw values")) {
Section("Querying raw values") {
ForEach(self.queryingItems, id: \.title) { item in
Menu.ItemView(
title: item.title,
NavigationLink(
destination: {
Modern.TimeZonesDemo.ListView(
title: item.title,
value: item.value()
)
},
label: {
Menu.ItemView(
title: item.title
)
}
)
}
}
}
.listStyle(GroupedListStyle())
.navigationBarTitle("Time Zones")
.listStyle(.grouped)
.navigationTitle("Time Zones")
}
@@ -217,18 +235,3 @@ extension Modern.TimeZonesDemo {
}
}
}
#if DEBUG
struct _Demo_Modern_TimeZonesDemo_MainView_Preview: PreviewProvider {
// MARK: PreviewProvider
static var previews: some View {
Modern.TimeZonesDemo.MainView()
}
}
#endif
@@ -11,8 +11,8 @@ extension Modern {
// MARK: - Modern.TimeZonesDemo
/**
Sample usages for creating Fetch and Query clauses for `CoreStoreObject`s
*/
Sample usages for creating Fetch and Query clauses for `CoreStoreObject`s
*/
enum TimeZonesDemo {
// MARK: Internal