-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add isDelimiter to VisualInstructionComponent (#224)
- Loading branch information
Bobby Sudekum
authored
Jan 17, 2018
1 parent
b0bf987
commit 8463f0d
Showing
3 changed files
with
74 additions
and
3 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,42 @@ | ||
import Foundation | ||
|
||
/** | ||
`VisualInstructionComponentType` describes the type of `VisualInstructionComponent`. | ||
*/ | ||
@objc(MBVisualInstructionComponentType) | ||
public enum VisualInstructionComponentType: Int, CustomStringConvertible { | ||
|
||
/** | ||
The component separates two other destination components. | ||
If the two adjacent components are both displayed as images, you can hide this delimiter component. | ||
*/ | ||
case delimiter | ||
|
||
/** | ||
The component bears an exit number or the name of a place or street. | ||
*/ | ||
case destination | ||
|
||
public init?(description: String) { | ||
let type: VisualInstructionComponentType | ||
switch description { | ||
case "delimiter": | ||
type = .delimiter | ||
case "destination": | ||
type = .destination | ||
default: | ||
return nil | ||
} | ||
self.init(rawValue: type.rawValue) | ||
} | ||
|
||
public var description: String { | ||
switch self { | ||
case .delimiter: | ||
return "delimiter" | ||
case .destination: | ||
return "destination" | ||
} | ||
} | ||
} |