Permalink
Browse files

Remove UIKitComponentManager.

  • Loading branch information...
guidomb committed May 31, 2017
1 parent 780b4c3 commit 757a2a6f4be997c50f5155e3b63bc894abfc3ec4
@@ -65,7 +65,6 @@
9D8C84B11ECA3B750034C6BC /* TableRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D8C847E1ECA3B750034C6BC /* TableRenderer.swift */; };
9D8C84B21ECA3B750034C6BC /* TextFieldRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D8C847F1ECA3B750034C6BC /* TextFieldRenderer.swift */; };
9D8C84B31ECA3B750034C6BC /* TouchableRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D8C84801ECA3B750034C6BC /* TouchableRenderer.swift */; };
9D8C84B41ECA3B750034C6BC /* UIKitComponentManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D8C84811ECA3B750034C6BC /* UIKitComponentManager.swift */; };
9D8C84B51ECA3B750034C6BC /* UIKitRenderable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D8C84821ECA3B750034C6BC /* UIKitRenderable.swift */; };
9D8C84B61ECA3B750034C6BC /* UIKitRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D8C84831ECA3B750034C6BC /* UIKitRenderer.swift */; };
9D8C84B71ECA3B750034C6BC /* UIViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D8C84841ECA3B750034C6BC /* UIViewExtensions.swift */; };
@@ -185,7 +184,6 @@
9D8C847E1ECA3B750034C6BC /* TableRenderer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRenderer.swift; sourceTree = "<group>"; };
9D8C847F1ECA3B750034C6BC /* TextFieldRenderer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldRenderer.swift; sourceTree = "<group>"; };
9D8C84801ECA3B750034C6BC /* TouchableRenderer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TouchableRenderer.swift; sourceTree = "<group>"; };
9D8C84811ECA3B750034C6BC /* UIKitComponentManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIKitComponentManager.swift; sourceTree = "<group>"; };
9D8C84821ECA3B750034C6BC /* UIKitRenderable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIKitRenderable.swift; sourceTree = "<group>"; };
9D8C84831ECA3B750034C6BC /* UIKitRenderer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIKitRenderer.swift; sourceTree = "<group>"; };
9D8C84841ECA3B750034C6BC /* UIViewExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIViewExtensions.swift; sourceTree = "<group>"; };
@@ -367,7 +365,6 @@
9D8C846D1ECA3B750034C6BC /* PortalTableView.swift */,
9D8C846E1ECA3B750034C6BC /* PortalTableViewCell.swift */,
9D8C846F1ECA3B750034C6BC /* PortalViewController.swift */,
9D8C84811ECA3B750034C6BC /* UIKitComponentManager.swift */,
9D8C84821ECA3B750034C6BC /* UIKitRenderable.swift */,
9D8C84831ECA3B750034C6BC /* UIKitRenderer.swift */,
9D8C84841ECA3B750034C6BC /* UIViewExtensions.swift */,
@@ -651,7 +648,6 @@
9D8C84A61ECA3B750034C6BC /* CollectionRenderer.swift in Sources */,
9D8C849C1ECA3B750034C6BC /* PortalCarouselView.swift in Sources */,
9D8C849B1ECA3B750034C6BC /* MessageDispatcher.swift in Sources */,
9D8C84B41ECA3B750034C6BC /* UIKitComponentManager.swift in Sources */,
9D8C84A11ECA3B750034C6BC /* PortalTableView.swift in Sources */,
9D8C84A91ECA3B750034C6BC /* FontRenderer.swift in Sources */,
9D8C849A1ECA3B750034C6BC /* StyleSheet.swift in Sources */,
@@ -134,12 +134,18 @@ public protocol ApplicationRenderer {

associatedtype MessageType
associatedtype RouteType: Route

func render(component: Component<Action<RouteType, MessageType>>, with root: RootComponent<Action<RouteType, MessageType>>, orientation: SupportedOrientations)
associatedtype NavigatorType: Equatable

typealias ViewType = View<RouteType, MessageType, NavigatorType>
typealias ActionType = Action<RouteType, MessageType>

var mailbox: Mailbox<ActionType> { get }

func render(view: ViewType, completion: @escaping () -> Void)

func present(component: Component<Action<RouteType, MessageType>>, with root: RootComponent<Action<RouteType, MessageType>>, modally: Bool, orientation: SupportedOrientations, completion: @escaping () -> Void)
func present(view: ViewType, completion: @escaping () -> Void)

func present(alert: AlertProperties<Action<RouteType, MessageType>>, completion: @escaping () -> Void)
func presentModal(view: ViewType, completion: @escaping () -> Void)

func dismissCurrentNavigator(completion: @escaping () -> Void)

@@ -30,6 +30,7 @@ public class ApplicationRunner<
ApplicationType.SubscriptionType == CustomSubscriptionType,
ApplicationRendererType.MessageType == MessageType,
ApplicationRendererType.RouteType == RouteType,
ApplicationRendererType.NavigatorType == NavigatorType,
CommandExecutorType.MessageType == Action<RouteType, MessageType>,
CommandExecutorType.CommandType == CommandType,
CustomSubscriptionManager.SubscriptionType == CustomSubscriptionType,
@@ -196,56 +197,14 @@ internal extension ApplicationRunner {
fileprivate extension ApplicationRunner {

fileprivate func render(view: ViewType) {
switch view.content {

case .alert(let properties):
// When presenting an alert we need to stop
// processing messages until the view transition
// has been executed to avoid modifying the view
// in the middle of an animation / transition.
//
// By using the `executeRendererTransition` method
// we are wrapping the method that performs the
// view transition inside a scope that suspend / resumes
// operations enqueued in the dispatch queue.
executeRendererTransition { renderer, completion in
renderer.present(alert: properties, completion: completion)
}

case .component(let component):
self.renderer?.render(component: component, with: view.root, orientation: view.orientation)

}
executeRendererTransition { $0.render(view: view, completion: $1) }
}

fileprivate func present(view: ViewType, modally: Bool) {
// When presenting a new view we need to stop
// processing messages until the view transition
// has been executed to avoid modifying the view
// in the middle of an animation / transition.
//
// By using the `executeRendererTransition` method
// we are wrapping the method that performs the
// view transition inside a scope that suspend / resumes
// operations enqueued in the dispatch queue.
switch view.content {

case .alert(let properties):
executeRendererTransition { renderer, completion in
renderer.present(alert: properties, completion: completion)
}

case .component(let component):
executeRendererTransition { renderer, completion in
renderer.present(
component: component,
with: view.root,
modally: modally,
orientation: view.orientation,
completion: completion
)
}

if modally {
executeRendererTransition { $0.presentModal(view: view, completion: $1) }
} else {
executeRendererTransition { $0.present(view: view, completion: $1) }
}
}

@@ -57,7 +57,7 @@ public class UIKitApplicationContext<
RouteType,
NavigatorType,
ApplicationType,
UIKitApplicationRenderer<MessageType, RouteType, CustomComponentRendererType>,
UIKitApplicationRenderer<MessageType, RouteType, NavigatorType, CustomComponentRendererType>,
CommandExecutorType,
CustomSubscriptionManager>

Oops, something went wrong.

0 comments on commit 757a2a6

Please sign in to comment.