Skip to content
Open
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
4 changes: 4 additions & 0 deletions Source/JSONKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
//

import Foundation
#if !os(Linux)
import CoreGraphics
#endif

// MARK: - JSONKey

Expand Down Expand Up @@ -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.

Expand All @@ -241,6 +244,7 @@ extension JSON {
public subscript(key: JSONKey<CGFloat>) -> CGFloat {
return self[key.type].cgFloatValue
}
#endif
}

// MARK: - Bool
Expand Down
4 changes: 4 additions & 0 deletions Source/Properties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
//

import Foundation
#if !os(Linux)
import CoreGraphics
#endif

// MARK: - JSON

Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Source/Supporting Files/JASON.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
//

@import Foundation;
#if !TARGET_OS_LINUX
@import CoreGraphics.CGBase;
#endif

FOUNDATION_EXPORT double JASONVersionNumber;
FOUNDATION_EXPORT const unsigned char JASONVersionString[];