-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from Rallista/feat/gestures-and-better-camera
Revisions for camera behavior, added basic gesture methods, separated…
- Loading branch information
Showing
43 changed files
with
1,602 additions
and
385 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
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 |
---|---|---|
@@ -1,34 +1,46 @@ | ||
import Foundation | ||
|
||
@resultBuilder | ||
public enum MapViewContentBuilder { | ||
|
||
public static func buildBlock(_ layers: [StyleLayerDefinition]...) -> [StyleLayerDefinition] { | ||
return layers.flatMap { $0 } | ||
} | ||
|
||
public static func buildOptional(_ layers: [StyleLayerDefinition]?) -> [StyleLayerDefinition] { | ||
return layers ?? [] | ||
public enum MapViewContentBuilder: DefaultResultBuilder { | ||
public static func buildExpression(_ expression: StyleLayerDefinition) -> [StyleLayerDefinition] { | ||
return [expression] | ||
} | ||
|
||
public static func buildExpression(_ layer: StyleLayerDefinition) -> [StyleLayerDefinition] { | ||
return [layer] | ||
public static func buildExpression(_ expression: [StyleLayerDefinition]) -> [StyleLayerDefinition] { | ||
return expression | ||
} | ||
|
||
public static func buildExpression(_ expression: Void) -> [StyleLayerDefinition] { | ||
return [] | ||
} | ||
|
||
public static func buildExpression(_ styleCollection: StyleLayerCollection) -> [StyleLayerDefinition] { | ||
return styleCollection.layers | ||
public static func buildBlock(_ components: [StyleLayerDefinition]...) -> [StyleLayerDefinition] { | ||
return components.flatMap { $0 } | ||
} | ||
|
||
public static func buildArray(_ components: [StyleLayerDefinition]) -> [StyleLayerDefinition] { | ||
return components | ||
} | ||
|
||
public static func buildArray(_ components: [[StyleLayerDefinition]]) -> [StyleLayerDefinition] { | ||
return components.flatMap { $0 } | ||
} | ||
|
||
public static func buildEither(first layer: [StyleLayerDefinition]) -> [StyleLayerDefinition] { | ||
return layer | ||
public static func buildEither(first components: [StyleLayerDefinition]) -> [StyleLayerDefinition] { | ||
return components | ||
} | ||
|
||
public static func buildEither(second layer: [StyleLayerDefinition]) -> [StyleLayerDefinition] { | ||
return layer | ||
public static func buildEither(second components: [StyleLayerDefinition]) -> [StyleLayerDefinition] { | ||
return components | ||
} | ||
|
||
public static func buildOptional(_ components: [StyleLayerDefinition]?) -> [StyleLayerDefinition] { | ||
return components ?? [] | ||
} | ||
|
||
// MARK: Custom Handler for StyleLayerCollection type. | ||
|
||
public static func buildExpression(_ styleCollection: StyleLayerCollection) -> [StyleLayerDefinition] { | ||
return styleCollection.layers | ||
} | ||
} |
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
39 changes: 39 additions & 0 deletions
39
Sources/MapLibreSwiftDSL/Support/DefaultResultBuilder.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,39 @@ | ||
import Foundation | ||
|
||
/// Enforces a basic set of result builder definiitons. | ||
/// | ||
/// This is just a tool to make a result builder easier to build, maintain sorting, etc. | ||
protocol DefaultResultBuilder { | ||
|
||
associatedtype Component | ||
|
||
static func buildExpression(_ expression: Component) -> [Component] | ||
|
||
static func buildExpression(_ expression: [Component]) -> [Component] | ||
|
||
// MARK: Handle void | ||
|
||
static func buildExpression(_ expression: Void) -> [Component] | ||
|
||
// MARK: Combine elements into an array | ||
|
||
static func buildBlock(_ components: [Component]...) -> [Component] | ||
|
||
// MARK: Handle Arrays | ||
|
||
static func buildArray(_ components: [Component]) -> [Component] | ||
|
||
// MARK: Handle for in loops | ||
|
||
static func buildArray(_ components: [[Component]]) -> [Component] | ||
|
||
// MARK: Handle if statements | ||
|
||
static func buildEither(first components: [Component]) -> [Component] | ||
|
||
static func buildEither(second components: [Component]) -> [Component] | ||
|
||
// MARK: Handle Optionals | ||
|
||
static func buildOptional(_ components: [Component]?) -> [Component] | ||
} |
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
Oops, something went wrong.