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

Be less restrictive about the chosen swiftlint version #28

Merged
merged 3 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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 @@ -37,17 +37,17 @@
/// }
/// ```
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 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

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

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


public var body: some View {
if let task = createTask(questionnaire: questionnaire) {
ORKOrderedTaskView(tasks: task, tintColor: .accentColor, cancelBehavior: cancelBehavior, result: handleResult)

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

View workflow job for this annotation

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

non-sendable type 'QuestionnaireView' exiting main actor-isolated context in call to non-isolated instance method 'handleResult' cannot cross actor boundary

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

View workflow job for this annotation

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

non-sendable type 'QuestionnaireView' exiting main actor-isolated context in call to non-isolated instance method 'handleResult' cannot cross actor boundary
.ignoresSafeArea(.container, edges: .bottom)
.ignoresSafeArea(.keyboard, edges: .bottom)
.interactiveDismissDisabled()
Expand Down Expand Up @@ -86,7 +86,7 @@
questionnaireResult = .failed
}

await self.questionnaireResult(questionnaireResult)

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

View workflow job for this annotation

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

passing argument of non-sendable type 'QuestionnaireResult' into main actor-isolated context may introduce data races

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

View workflow job for this annotation

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

passing argument of non-sendable type 'QuestionnaireResult' into main actor-isolated context may introduce data races
}


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
Loading