Skip to content

Commit

Permalink
Be less restrictive about the chosen swiftlint version (#28)
Browse files Browse the repository at this point in the history
# Be less restrictive about the chosen swiftlint version

## ♻️ Current situation & Problem
This PR loosens the restrictions on the swiftlint version.


## ⚙️ Release Notes 
* Allow upToNextMajor swiftlint versions.
* Some additional concurrency fixes.

## 📚 Documentation
--


## ✅ Testing
--

## 📝 Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
Supereg authored Aug 29, 2024
1 parent 853585f commit d0bd55f
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 13 deletions.
8 changes: 4 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import PackageDescription


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


Expand All @@ -34,7 +34,7 @@ let package = Package(
.package(url: "https://github.com/StanfordSpezi/SpeziViews", from: "1.0.0"),
.package(url: "https://github.com/apple/FHIRModels", .upToNextMinor(from: "0.5.0")),
.package(url: "https://github.com/StanfordBDHG/ResearchKit", from: "3.0.1"),
.package(url: "https://github.com/StanfordBDHG/ResearchKitOnFHIR", from: "2.0.0")
.package(url: "https://github.com/StanfordBDHG/ResearchKitOnFHIR", from: "2.0.1")
] + swiftLintPackage(),
targets: [
.target(
Expand Down Expand Up @@ -89,7 +89,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", .upToNextMinor(from: "0.55.1"))]
[.package(url: "https://github.com/realm/SwiftLint.git", from: "0.55.1")]
} else {
[]
}
Expand Down
6 changes: 5 additions & 1 deletion Sources/SpeziQuestionnaire/Identifier+Identifiable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@
import ModelsR4


extension Identifier: Identifiable {}
#if compiler(<6)
extension ModelsR4.Identifier: Swift.Identifiable {}
#else
extension Identifier: @retroactive Identifiable {}
#endif
3 changes: 3 additions & 0 deletions Sources/SpeziQuestionnaire/QuestionnaireResult.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ public enum QuestionnaireResult {
/// The questionnaire task failed due to an error.
case failed
}


extension QuestionnaireResult: Hashable {}
2 changes: 1 addition & 1 deletion Sources/SpeziQuestionnaire/QuestionnaireView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public struct QuestionnaireView: View {
private static let logger = Logger(subsystem: "edu.stanford.spezi.questionnaire", category: "QuestionnaireView")

Check warning on line 40 in Sources/SpeziQuestionnaire/QuestionnaireView.swift

View workflow job for this annotation

GitHub Actions / Build and Test UI Tests / Test using xcodebuild or run fastlane

static property 'logger' is not concurrency-safe because it is not either conforming to 'Sendable' or isolated to a global actor; this is an error in Swift 6

Check warning on line 40 in Sources/SpeziQuestionnaire/QuestionnaireView.swift

View workflow job for this annotation

GitHub Actions / Build and Test UI Tests / Test using xcodebuild or run fastlane

static property 'logger' is not concurrency-safe because it is not either conforming to 'Sendable' or isolated to a global actor; this is an error in Swift 6

Check warning on line 40 in Sources/SpeziQuestionnaire/QuestionnaireView.swift

View workflow job for this annotation

GitHub Actions / Build and Test Swift Package / Test using xcodebuild or run fastlane

static property 'logger' is not concurrency-safe because it is not either conforming to 'Sendable' or isolated to a global actor; this is an error in Swift 6

Check warning on line 40 in Sources/SpeziQuestionnaire/QuestionnaireView.swift

View workflow job for this annotation

GitHub Actions / Build and Test Swift Package / Test using xcodebuild or run fastlane

static property 'logger' is not concurrency-safe because it is not either conforming to 'Sendable' or isolated to a global actor; this is an error in Swift 6

private let questionnaire: Questionnaire
private let questionnaireResult: (QuestionnaireResult) async -> Void
private let questionnaireResult: @MainActor (QuestionnaireResult) async -> Void
private let completionStepMessage: String?
private let cancelBehavior: CancelBehavior

Expand Down
2 changes: 1 addition & 1 deletion Sources/SpeziTimedWalkTest/TimedWalkTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation


/// Defines the configuration of a timed walk test.
public struct TimedWalkTest: Codable, Equatable, Hashable {
public struct TimedWalkTest: Codable, Equatable, Hashable, Sendable {
/// Default values.
public enum Defaults {
/// Default timed walk test duration.
Expand Down
7 changes: 4 additions & 3 deletions Sources/SpeziTimedWalkTest/TimedWalkTestCompletedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct TimedWalkTestCompletedView: View {
Button("Restart", role: .destructive) {
dismiss()
}
AsyncButton(action: completeAction) {
Button(action: completeAction) {
Text("Done")
.frame(maxWidth: .infinity, minHeight: 38)
}
Expand Down Expand Up @@ -68,8 +68,9 @@ struct TimedWalkTestCompletedView: View {
.bold()
.padding()
}

private func completeAction() async {

@MainActor
private func completeAction() {
walkTestViewModel.completeWalkTest()
}
}
Expand Down
3 changes: 2 additions & 1 deletion Sources/SpeziTimedWalkTest/TimedWalkTestRunningView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ struct TimedWalkTestRunningView: View {
.modifier(TimedWalkTestCancelModifier())
}



@MainActor
private func start() async {
withAnimation {
prepareCountDown = Date.now.addingTimeInterval(5)
Expand Down
3 changes: 2 additions & 1 deletion Sources/SpeziTimedWalkTest/TimedWalkTestView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public struct TimedWalkTestView: View {
.environment(walkTestViewModel)
}



@MainActor
public init(
timedWalkTest: TimedWalkTest = TimedWalkTest(),
completion: @escaping (TimedWalkTestViewResult) -> Void
Expand Down
3 changes: 2 additions & 1 deletion Sources/SpeziTimedWalkTest/TimedWalkTestViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import Foundation
import SwiftUI


@MainActor
@Observable
class TimedWalkTestViewModel {
class TimedWalkTestViewModel: Sendable {
let pedometer = CMPedometer()

let timedWalkTest: TimedWalkTest
Expand Down

0 comments on commit d0bd55f

Please sign in to comment.