Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Task model using SwiftData and Schedule creation using Calendar Recurrence Rule #44

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0db1f38
Initial draft state
Supereg Aug 23, 2024
c9efcc7
Use Foundation RecurrenceRule for Schedule. Remove schedule component…
Supereg Aug 24, 2024
8c444c7
Public init
Supereg Aug 24, 2024
010dfd7
Ensure it compiles
Supereg Aug 24, 2024
a3f0f3d
Iterate on Model and add support to query events
Supereg Aug 24, 2024
2b7c443
Make environment accessible
Supereg Aug 24, 2024
1ca335c
Some progress
Supereg Sep 3, 2024
102dd7d
Iterate
Supereg Sep 3, 2024
7848353
A working version
Supereg Sep 4, 2024
5c0dc60
Some docs and cleanup
Supereg Sep 4, 2024
6d65471
Keep it working for now
Supereg Sep 4, 2024
8394cd5
Fix some previews
Supereg Sep 5, 2024
5961889
Refining a lot of things
Supereg Sep 6, 2024
9d52d0a
Initial preview release
Supereg Sep 6, 2024
136fe89
Bug fixes and adjustments and initial unit tests
Supereg Sep 6, 2024
61a9a5a
Run on latest Xcode
Supereg Sep 9, 2024
79e9398
redo
Supereg Sep 9, 2024
e6cf165
Concurrency for Xcode beta 5
Supereg Sep 9, 2024
952bf47
Do not require the macOS job right now
Supereg Sep 9, 2024
1f95c28
Finalize UI components
Supereg Sep 9, 2024
92f0cc3
Add macros :rocket:
Supereg Sep 9, 2024
ea7e1e9
Remove previous scheduler and provide most of the documentation
Supereg Sep 10, 2024
0ef47b8
Add UI tests
Supereg Sep 10, 2024
dcea771
Additional changes
Supereg Sep 10, 2024
117e466
Add unit tests for macro
Supereg Sep 11, 2024
49e2f2c
REUSE
Supereg Sep 11, 2024
77ae023
SchedulerUI target and redo category infrastructure to be more easy a…
Supereg Sep 11, 2024
7cc6590
Add snapshot testing for ui components
Supereg Sep 12, 2024
9e0618a
Fix REUSE
Supereg Sep 12, 2024
a81aaf0
Update scheme
Supereg Sep 12, 2024
c608f87
Declare SpeziSchedulerUI as a dependency for UI tests
Supereg Sep 12, 2024
5af6d19
Only run macOS unit tests if major version is 15
Supereg Sep 12, 2024
dac8d08
Use new environment file based output
Supereg Sep 12, 2024
39df9f4
Fix missing imports
Supereg Sep 12, 2024
aa31601
Moved Tile infrastructure to SpeziViews
Supereg Sep 12, 2024
478c777
Create TodayList
Supereg Sep 12, 2024
b57e276
Docs
Supereg Sep 12, 2024
e1e2986
SwiftData is insanity
Supereg Sep 12, 2024
55ed104
Fix description
Supereg Sep 12, 2024
a3c6ba6
Final restructuring and documentation
Supereg Sep 13, 2024
c609cf2
Do not purge previous storage for now
Supereg Sep 13, 2024
4a92a88
Move some tests do a different target
Supereg Sep 13, 2024
68895a9
Fix imports
Supereg Sep 13, 2024
b08e806
Fix import
Supereg Sep 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,56 @@ on:
workflow_dispatch:

jobs:
determine_macos_version: # Currently some runners still run on macOS 14
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All our runners should be update to macOS 15, we should be able to remove this now.

name: Determine macOS version
runs-on: ["macOS", "self-hosted"]
outputs:
macos_major_version: ${{ steps.get_version.outputs.major_version }}
steps:
- name: Get macOS major version
id: get_version
run: |
VERSION=$(sw_vers -productVersion | cut -d '.' -f 1)
echo "major_version=$VERSION >> $GITHUB_OUTPUT"
buildandtest_ios:
name: Build and Test Swift Package
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
runsonlabels: '["macOS", "self-hosted"]'
scheme: SpeziScheduler
scheme: SpeziScheduler-Package
xcodeversion: latest
resultBundle: SpeziScheduler-iOS.xcresult
artifactname: SpeziScheduler-iOS.xcresult
buildandtest_watchos:
name: Build and Test Swift Package watchOS
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
runsonlabels: '["macOS", "self-hosted"]'
scheme: SpeziScheduler
scheme: SpeziScheduler-Package
destination: 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm)'
xcodeversion: latest
resultBundle: SpeziScheduler-watchOS.xcresult
artifactname: SpeziScheduler-watchOS.xcresult
buildandtest_visionos:
name: Build and Test Swift Package visionOS
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
runsonlabels: '["macOS", "self-hosted"]'
scheme: SpeziScheduler
scheme: SpeziScheduler-Package
destination: 'platform=visionOS Simulator,name=Apple Vision Pro'
xcodeversion: latest
resultBundle: SpeziScheduler-visionOS.xcresult
artifactname: SpeziScheduler-visionOS.xcresult
buildandtest_macos:
name: Build and Test Swift Package macOS
needs: determine_macos_version
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
if: ${{ needs.determine_macos_version.outputs.macos_major_version >= 15 }}
with:
runsonlabels: '["macOS", "self-hosted"]'
scheme: SpeziScheduler
scheme: SpeziScheduler-Package
destination: 'platform=macOS,arch=arm64'
xcodeversion: latest
resultBundle: SpeziScheduler-macOS.xcresult
artifactname: SpeziScheduler-macOS.xcresult
buildandtestuitests_ios:
Expand All @@ -62,9 +79,9 @@ jobs:
scheme: TestApp
uploadcoveragereport:
name: Upload Coverage Report
needs: [buildandtest_ios, buildandtest_watchos, buildandtest_visionos, buildandtest_macos, buildandtestuitests_ios]
needs: [buildandtest_ios, buildandtest_watchos, buildandtest_visionos, buildandtestuitests_ios]
uses: StanfordSpezi/.github/.github/workflows/create-and-upload-coverage-report.yml@v2
with:
coveragereports: SpeziScheduler-iOS.xcresult SpeziScheduler-watchOS.xcresult SpeziScheduler-visionOS.xcresult SpeziScheduler-macOS.xcresult TestApp.xcresult
coveragereports: SpeziScheduler-iOS.xcresult SpeziScheduler-watchOS.xcresult SpeziScheduler-visionOS.xcresult TestApp.xcresult
secrets:
token: ${{ secrets.CODECOV_TOKEN }}
5 changes: 5 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/

Files: Tests/SpeziSchedulerUITests/__Snapshots__/*
Copyright: 2024 Stanford University and the project authors (see CONTRIBUTORS.md)
License: MIT
74 changes: 55 additions & 19 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.9
// swift-tools-version:6.0

//
// This source file is part of the Stanford Spezi open-source project
Expand All @@ -8,41 +8,61 @@
// SPDX-License-Identifier: MIT
//

import CompilerPluginSupport
import class Foundation.ProcessInfo
import PackageDescription


#if swift(<6)
let swiftConcurrency: SwiftSetting = .enableExperimentalFeature("StrictConcurrency")
#else
let swiftConcurrency: SwiftSetting = .enableUpcomingFeature("StrictConcurrency")
#endif


let package = Package(
name: "SpeziScheduler",
defaultLocalization: "en",
platforms: [
.iOS(.v17),
.macOS(.v14),
.visionOS(.v1),
.watchOS(.v10)
.iOS(.v18),
.macOS(.v15),
.visionOS(.v2),
.watchOS(.v11)
],
products: [
.library(name: "SpeziScheduler", targets: ["SpeziScheduler"])
.library(name: "SpeziScheduler", targets: ["SpeziScheduler"]),
.library(name: "SpeziSchedulerUI", targets: ["SpeziSchedulerUI"])
],
dependencies: [
.package(url: "https://github.com/StanfordSpezi/SpeziFoundation", from: "2.0.0-beta.2"),
.package(url: "https://github.com/StanfordSpezi/Spezi", from: "1.7.0"),
.package(url: "https://github.com/StanfordSpezi/SpeziStorage", from: "1.1.2")
.package(url: "https://github.com/StanfordSpezi/SpeziViews", branch: "feature/additional-infrastructure"),
.package(url: "https://github.com/StanfordSpezi/SpeziStorage", from: "1.1.2"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO to use a release before we merge the PR.

.package(url: "https://github.com/swiftlang/swift-syntax", from: "600.0.0-prerelease-2024-08-14"),
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing.git", from: "1.17.2")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

] + swiftLintPackage(),
targets: [
.macro(
name: "SpeziSchedulerMacros",
dependencies: [
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
.product(name: "SwiftDiagnostics", package: "swift-syntax")
],
plugins: [] + swiftLintPlugin()
),
.target(
name: "SpeziScheduler",
dependencies: [
.target(name: "SpeziSchedulerMacros"),
.product(name: "SpeziFoundation", package: "SpeziFoundation"),
.product(name: "Spezi", package: "Spezi"),
.product(name: "SpeziViews", package: "SpeziViews"),
.product(name: "SpeziLocalStorage", package: "SpeziStorage")
],
swiftSettings: [
swiftConcurrency
plugins: [] + swiftLintPlugin()
),
.target(
name: "SpeziSchedulerUI",
dependencies: [
.target(name: "SpeziScheduler"),
.product(name: "SpeziViews", package: "SpeziViews")
],
resources: [
.process("Resources")
],
plugins: [] + swiftLintPlugin()
),
Expand All @@ -53,8 +73,24 @@ let package = Package(
.product(name: "XCTSpezi", package: "Spezi"),
.product(name: "SpeziLocalStorage", package: "SpeziStorage")
],
swiftSettings: [
swiftConcurrency
plugins: [] + swiftLintPlugin()
),
.testTarget(
name: "SpeziSchedulerUITests",
dependencies: [
.target(name: "SpeziScheduler"),
.target(name: "SpeziSchedulerUI"),
.product(name: "XCTSpezi", package: "Spezi"),
.product(name: "SnapshotTesting", package: "swift-snapshot-testing")
],
plugins: [] + swiftLintPlugin()
),
.testTarget(
name: "SpeziSchedulerMacrosTest",
dependencies: [
"SpeziSchedulerMacros",
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax")
],
plugins: [] + swiftLintPlugin()
)
Expand All @@ -73,7 +109,7 @@ func swiftLintPlugin() -> [Target.PluginUsage] {

func swiftLintPackage() -> [PackageDescription.Package.Dependency] {
if ProcessInfo.processInfo.environment["SPEZI_DEVELOPMENT_SWIFTLINT"] != nil {
[.package(url: "https://github.com/realm/SwiftLint.git", from: "0.55.1")]
[.package(url: "https://github.com/realm/SwiftLint.git", from: "0.56.2")]
} else {
[]
}
Expand Down
Loading
Loading