-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add MBDirectionsPriority to SPM flavor
- Loading branch information
Showing
3 changed files
with
47 additions
and
4 deletions.
There are no files selected for viewing
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
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,40 @@ | ||
import Foundation | ||
|
||
|
||
public enum MBDirectionsPriority { | ||
public typealias RawValue = Double | ||
case low | ||
case `default` | ||
case high | ||
case custom(Double) | ||
} | ||
|
||
extension MBDirectionsPriority: RawRepresentable { | ||
public init(rawValue: Double) { | ||
switch rawValue { | ||
case MBDirectionsPriority.low.rawValue: | ||
self = .low | ||
case MBDirectionsPriority.default.rawValue: | ||
self = .default | ||
case MBDirectionsPriority.high.rawValue: | ||
self = .high | ||
case MBDirectionsPriority.custom(rawValue).rawValue: | ||
self = .custom(rawValue) | ||
default: | ||
self = .default | ||
} | ||
} | ||
|
||
public var rawValue: Double { | ||
switch self { | ||
case .low: | ||
return -1.0 | ||
case .default: | ||
return 0 | ||
case .high: | ||
return 1.0 | ||
case .custom(let val): | ||
return val | ||
} | ||
} | ||
} |