From f50d1dc393a74b0cc2b5ef152025184b0f38b55b Mon Sep 17 00:00:00 2001 From: 3ign0n <3ign0n@gmail.com> Date: Sun, 14 Feb 2021 15:11:51 +0900 Subject: [PATCH] fix compile error on linux (remove CoreGraphics dependency for linux) --- Source/JSONKey.swift | 4 ++++ Source/Properties.swift | 4 ++++ Source/Supporting Files/JASON.h | 2 ++ 3 files changed, 10 insertions(+) diff --git a/Source/JSONKey.swift b/Source/JSONKey.swift index 3142d4f..ffe6e6a 100644 --- a/Source/JSONKey.swift +++ b/Source/JSONKey.swift @@ -23,7 +23,9 @@ // import Foundation +#if !os(Linux) import CoreGraphics +#endif // MARK: - JSONKey @@ -220,6 +222,7 @@ extension JSON { return self[key.type].nsNumberValue } + #if !os(Linux) /** Returns the value associated with the given key as a CGFloat or nil if not present/convertible. @@ -241,6 +244,7 @@ extension JSON { public subscript(key: JSONKey) -> CGFloat { return self[key.type].cgFloatValue } + #endif } // MARK: - Bool diff --git a/Source/Properties.swift b/Source/Properties.swift index fb887a6..6ccfdb9 100644 --- a/Source/Properties.swift +++ b/Source/Properties.swift @@ -23,7 +23,9 @@ // import Foundation +#if !os(Linux) import CoreGraphics +#endif // MARK: - JSON @@ -68,10 +70,12 @@ extension JSON { /// The value as a NSNumber or 0 if not present/convertible public var nsNumberValue: NSNumber { return nsNumber ?? 0 } + #if !os(Linux) /// The value as a CGFloat or nil if not present/convertible public var cgFloat: CGFloat? { return nsNumber != nil ? CGFloat(truncating: nsNumber!) : nil } /// The value as a CGFloat or 0.0 if not present/convertible public var cgFloatValue: CGFloat { return cgFloat ?? 0 } + #endif } // MARK: - Bool diff --git a/Source/Supporting Files/JASON.h b/Source/Supporting Files/JASON.h index b518dd6..6cab201 100644 --- a/Source/Supporting Files/JASON.h +++ b/Source/Supporting Files/JASON.h @@ -23,7 +23,9 @@ // @import Foundation; +#if !TARGET_OS_LINUX @import CoreGraphics.CGBase; +#endif FOUNDATION_EXPORT double JASONVersionNumber; FOUNDATION_EXPORT const unsigned char JASONVersionString[];