<commit_before>//
//  UIKitRenderer.swift
//  PortalView
//
//  Created by <NAME> on 2/14/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import UIKit

public protocol UIKitCustomComponentRenderer {
    
    associatedtype MessageType
    
    init(container: UIViewController)
    
    func renderComponent(withIdentifier identifier: String, inside view: UIView, dispatcher: (MessageType) -> Void)
    
}

public struct VoidCustomComponentRenderer<MessageType>: UIKitCustomComponentRenderer {
    
    public init(container: UIViewController) {
        
    }
        
    public func renderComponent(withIdentifier identifier: String, inside view: UIView, dispatcher: (MessageType) -> Void) {
        
    }
}

public struct UIKitComponentRenderer<MessageType, CustomComponentRendererType: UIKitCustomComponentRenderer>: Renderer
    where CustomComponentRendererType.MessageType == MessageType {
    
    public typealias CustomComponentRendererFactory = () -> CustomComponentRendererType
    
    public var isDebugModeEnabled: Bool = false
    
    internal let layoutEngine: LayoutEngine
    internal let rendererFactory: CustomComponentRendererFactory
    
    private let containerView: UIView
    
    public init(
        containerView: UIView,
        layoutEngine: LayoutEngine = YogaLayoutEngine(),
        rendererFactory: @escaping CustomComponentRendererFactory) {
        self.containerView = containerView
        self.rendererFactory = rendererFactory
        self.layoutEngine = layoutEngine
    }<commit_msg>Add @escaping to dispatcher in custom renderer.<commit_after>//
//  UIKitRenderer.swift
//  PortalView
//
//  Created by <NAME> on 2/14/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import UIKit

public protocol UIKitCustomComponentRenderer {
    
    associatedtype MessageType
    
    init(container: UIViewController)
    
    func renderComponent(withIdentifier identifier: String, inside view: UIView, dispatcher: @escaping (MessageType) -> Void)
    
}

public struct VoidCustomComponentRenderer<MessageType>: UIKitCustomComponentRenderer {
    
    public init(container: UIViewController) {
        
    }
        
    public func renderComponent(withIdentifier identifier: String, inside view: UIView, dispatcher: @escaping (MessageType) -> Void) {
        
    }
}

public struct UIKitComponentRenderer<MessageType, CustomComponentRendererType: UIKitCustomComponentRenderer>: Renderer
    where CustomComponentRendererType.MessageType == MessageType {
    
    public typealias CustomComponentRendererFactory = () -> CustomComponentRendererType
    
    public var isDebugModeEnabled: Bool = false
    
    internal let layoutEngine: LayoutEngine
    internal let rendererFactory: CustomComponentRendererFactory
    
    private let containerView: UIView
    
    public init(
        containerView: UIView,
        layoutEngine: LayoutEngine = YogaLayoutEngine(),
        rendererFactory: @escaping CustomComponentRendererFactory) {
        self.containerView = containerView
        self.rendererFactory = rendererFactory
        self.layoutEngine = layoutEngine
    }
{'fraction_non_alphanumeric': 0.06832694763729247, 'fraction_numerical': 0.005747126436781609, 'mean_word_length': 3.4757142857142855, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2469765', 'n_tokens_mistral': 802, 'n_tokens_neox': 769, 'n_words': 204}