-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'refs/remotes/origin/SM-004-Streak'
Conflicts: Bilbary for iPhone/Bilbary.swift
- Loading branch information
Showing
15 changed files
with
176 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// AppModel.swift | ||
// Bilbary for iPhone | ||
// | ||
// Created by Guillaume Coquard on 11/07/24. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
import SwiftData | ||
|
||
@Model | ||
class ReadSession: Identifiable { | ||
|
||
typealias ID = UUID | ||
|
||
@Attribute(.unique) | ||
let id: ID = ID() | ||
|
||
let startTime: Date | ||
private(set) var endTime: Date? | ||
|
||
init() { | ||
self.startTime = .now | ||
} | ||
|
||
func end() -> Self { | ||
self.endTime = .now | ||
return self | ||
} | ||
|
||
} | ||
|
||
@MainActor | ||
let AppModelContainer: ModelContainer = { | ||
do { | ||
let container = try ModelContainer(for: ReadSession.self) | ||
return container | ||
} catch { | ||
fatalError("Failed to create container") | ||
} | ||
}() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.