Skip to content

Commit

Permalink
Use CGFloat(truncating:)
Browse files Browse the repository at this point in the history
  • Loading branch information
delba committed Aug 18, 2019
1 parent 968ba10 commit d07470a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Source/Properties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ extension JSON {
public var nsNumberValue: NSNumber { return nsNumber ?? 0 }

/// The value as a CGFloat or nil if not present/convertible
public var cgFloat: CGFloat? { return nsNumber != nil ? CGFloat(nsNumber!) : nil }
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 }
}
Expand Down

0 comments on commit d07470a

Please sign in to comment.