Skip to content

Commit d79cdd9

Browse files
authored
Merge pull request #8 from easydev991/develop-1.4
- Поправил релизную сборку - Дополнил ридми
2 parents 4f6d1b0 + 51ea02b commit d79cdd9

File tree

8 files changed

+49
-18
lines changed

8 files changed

+49
-18
lines changed

.swiftformat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
--ifdef no-indent
2+
13
--exclude SwiftUI-DaysUITests/SnapshotHelper.swift

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@
55
- Идея приложения в том, чтобы было удобно запоминать события в указанные даты, а потом легко проверить, сколько прошло дней с момента события.
66
- Это вторая версия моего пет-проекта. Первая версия находится [тут](https://github.com/easydev991/Days), и я не публиковал ее в `AppStore`.
77

8+
## Начало работы
9+
10+
1. Клонируйте репозиторий
11+
2. В терминале перейдите в папку с проектом
12+
3. Все зависимости можно установить с помощью команд из `Makefile`:
13+
- Ознакомиться с доступными командами можно, выполнив команду:
14+
```shell
15+
make help
16+
```
17+
- Для установки всех зависимостей используйте команду:
18+
```shell
19+
make install
20+
```
21+
- После этого вы сможете запускать другие команды из `Makefile` для форматирования кода, генерации скриншотов и обновления зависимостей
22+
823
## Что можно делать в приложении
924
1. Создавать/изменять/сортировать/удалять записи
1025
2. Посмотреть, сколько дней назад произошло записанное событие
@@ -13,6 +28,10 @@
1328
5. Удалить все записи разом, если нужно
1429

1530
## Скриншоты
31+
Для генерации скриншотов используется команда:
32+
```shell
33+
make fastlane
34+
```
1635
### iPhone
1736
| Список записей | Создание новой записи | Сортировка на главном экране |
1837
| --- | --- | --- |

SwiftUI-Days/Screens/Main/Detail/EditItemScreen.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,10 @@ struct EditItemScreen: View {
108108
}
109109
}
110110

111+
#if DEBUG
111112
#Preview {
112113
NavigationStack {
113114
EditItemScreen(oldItem: .singleLong, closeAction: {})
114115
}
115116
}
117+
#endif

SwiftUI-Days/Screens/Main/Detail/ItemScreen.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ struct ItemScreen: View {
6464
}
6565
}
6666

67+
#if DEBUG
6768
#Preview("Много текста") {
6869
NavigationStack {
6970
ItemScreen(item: .singleLong)
7071
}
7172
}
73+
#endif

SwiftUI-Days/Screens/Main/MainScreen+ListView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@ extension MainScreen {
7272
}
7373
}
7474

75+
#if DEBUG
7576
#Preview {
7677
NavigationStack {
7778
MainScreen.ListView(editItem: .constant(nil))
7879
.modelContainer(PreviewModelContainer.make(with: Item.makeList()))
7980
}
8081
}
82+
#endif

SwiftUI-Days/Screens/Main/MainScreen.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ struct MainScreen: View {
100100
.modelContainer(for: Item.self, inMemory: true)
101101
}
102102

103+
#if DEBUG
103104
#Preview("Список") {
104105
MainScreen()
105106
.modelContainer(PreviewModelContainer.make(with: Item.makeList()))
106107
}
108+
#endif

SwiftUI-Days/Screens/More/AppDataScreen.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,12 @@ extension AppDataScreen {
152152
}
153153
}
154154

155+
#if DEBUG
155156
#Preview {
156157
NavigationStack {
157158
AppDataScreen()
158159
.environment(AppSettings())
159160
.modelContainer(PreviewModelContainer.make(with: Item.makeList()))
160161
}
161162
}
163+
#endif

SwiftUI-Days/SwiftUI_DaysApp.swift

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,13 @@ struct SwiftUI_DaysApp: App {
1414
private let sharedModelContainer: ModelContainer
1515

1616
#if DEBUG
17-
init() {
18-
if ProcessInfo.processInfo.arguments.contains("UITest") {
19-
UIView.setAnimationsEnabled(false)
20-
sharedModelContainer = PreviewModelContainer.make(
21-
with: Item.makeDemoList(isEnglish: Locale.current.identifier == "en-US")
22-
)
23-
} else {
24-
let schema = Schema([Item.self])
25-
let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
26-
do {
27-
sharedModelContainer = try ModelContainer(for: schema, configurations: [modelConfiguration])
28-
} catch {
29-
fatalError("Не смогли создать ModelContainer: \(error)")
30-
}
31-
}
32-
}
33-
#else
34-
init() {
17+
init() {
18+
if ProcessInfo.processInfo.arguments.contains("UITest") {
19+
UIView.setAnimationsEnabled(false)
20+
sharedModelContainer = PreviewModelContainer.make(
21+
with: Item.makeDemoList(isEnglish: Locale.current.identifier == "en-US")
22+
)
23+
} else {
3524
let schema = Schema([Item.self])
3625
let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
3726
do {
@@ -40,6 +29,17 @@ struct SwiftUI_DaysApp: App {
4029
fatalError("Не смогли создать ModelContainer: \(error)")
4130
}
4231
}
32+
}
33+
#else
34+
init() {
35+
let schema = Schema([Item.self])
36+
let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
37+
do {
38+
sharedModelContainer = try ModelContainer(for: schema, configurations: [modelConfiguration])
39+
} catch {
40+
fatalError("Не смогли создать ModelContainer: \(error)")
41+
}
42+
}
4343
#endif
4444

4545
var body: some Scene {

0 commit comments

Comments
 (0)