-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#45: Switch from Int ids to UInt ids if overflow happens and the id i…
…s not negative
- Loading branch information
Showing
3 changed files
with
83 additions
and
14 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
Sources/GISTools/Extensions/FeatureIdentifierExtensions.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import Foundation | ||
|
||
// MARK: Public | ||
|
||
extension Feature.Identifier { | ||
|
||
public var int64Value: Int64? { | ||
switch self { | ||
case .int(let int): Int64(exactly: int) | ||
case .uint(let uint): Int64(exactly: uint) | ||
default: nil | ||
} | ||
} | ||
|
||
public var uint64Value: UInt64? { | ||
switch self { | ||
case .int(let int): UInt64(exactly: int) | ||
case .uint(let uint): UInt64(exactly: uint) | ||
default: nil | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters