Skip to content

Commit

Permalink
Enable strict concurrency checking
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnuravi committed Nov 25, 2024
1 parent 2c03e0e commit 4cad612
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
26 changes: 23 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.8
// swift-tools-version:6.0

//
// This source file is part of the OMHModels open source project
Expand All @@ -8,18 +8,19 @@
// SPDX-License-Identifier: MIT
//

import class Foundation.ProcessInfo
import PackageDescription


let package = Package(
name: "OMHModels",
platforms: [
.iOS(.v16),

Check failure on line 18 in Package.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint

Trailing Comma Violation: Collection literals should not have trailing commas (trailing_comma)
.watchOS(.v9)
],
products: [
.library(name: "OMHModels", targets: ["OMHModels"])
],
dependencies: swiftLintPackage(),
targets: [
.target(
name: "OMHModels"
Expand All @@ -28,7 +29,26 @@ let package = Package(
name: "OMHModelsTests",
dependencies: [
.target(name: "OMHModels")
]
],
plugins: [] + swiftLintPlugin()
)
]
)


func swiftLintPlugin() -> [Target.PluginUsage] {
// Fully quit Xcode and open again with `open --env SPEZI_DEVELOPMENT_SWIFTLINT /Applications/Xcode.app`
if ProcessInfo.processInfo.environment["SPEZI_DEVELOPMENT_SWIFTLINT"] != nil {
[.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLint")]
} else {
[]
}
}

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")]
} else {
[]
}
}
8 changes: 2 additions & 6 deletions Sources/OMHModels/DateTime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,13 @@ import Foundation
public struct DateTime: Schema, Equatable {
/// The Open mHealth schema identifier
public static let schemaId = SchemaId(namespace: .ieee, name: "date-time", version: "1.0")

private static let formatter: ISO8601DateFormatter = {
let formatter = ISO8601DateFormatter()
return formatter
}()

let value: String // The value should be in ISO8601 format as per the schema.


public init(date: Date) {
self.value = DateTime.formatter.string(from: date)
let formatter = ISO8601DateFormatter()
self.value = formatter.string(from: date)
}

public init(from decoder: Decoder) throws {
Expand Down

0 comments on commit 4cad612

Please sign in to comment.