         self.viewCreationBlock = viewCreationBlock
     }
     
-    public func renderImageWithData(_ data: Data) -> UIImage {
-        let view = self.viewCreationBlock(data)
+    public func renderImageWithData(_ data: Data) -> SignalProducer<UIImage, NoError> {
+        return createProducer(
+            data,
+            viewCreationBlock: self.viewCreationBlock,
+            renderBlock: { view in
+                
+                UIGraphicsBeginImageContextWithOptions(data.size, self.opaque, 0)
+                defer { UIGraphicsEndImageContext() }
+                
+                draw(view: view, inContext: UIGraphicsGetCurrentContext()!)
+                
+                return UIGraphicsGetImageFromCurrentImageContext()!
+            }
+        )
+    }
+}
+
+fileprivate func createProducer<Data: RenderDataType>(
+    _ data: Data,
+    viewCreationBlock: @escaping (_ data: Data) -> UIView,
+    renderBlock: @escaping (UIView) -> UIImage
+) -> SignalProducer<UIImage, NoError> {
+    return SignalProducer { observer, disposable in
+        let view = viewCreationBlock(data)
         view.frame.origin = .zero
         view.bounds.size = data.size
         view.layoutIfNeeded()
         
-        UIGraphicsBeginImageContextWithOptions(data.size, self.opaque, 0)
-        defer { UIGraphicsEndImageContext() }
-        
-        precondition(
-            view.drawHierarchy(in: view.bounds, afterScreenUpdates: true),
-            "Error generating snapshot"
-        )
-        
-        return UIGraphicsGetImageFromCurrentImageContext()!
+        // Make the CA renderer wait "until all the post-commit triggers fire".
+        // We can't take a snapshot right away because the view has not been commited to the render server yet.
+        DispatchQueue.main.async {
+            if !disposable.isDisposed {
+                observer.send(value: renderBlock(view))
+                observer.sendCompleted()
+            }
+        }
     }
+        .start(on: UIScheduler())
 }
+
+fileprivate func draw(view: UIView, inContext context: CGContext) {
+    view.layer.render(in: context)
+}

import UIKit
import CoreGraphics

/// `SynchronousRendererType` which generates a `UIImage` from a UIView.
@available(iOS 10.0, tvOSApplicationExtension 10.0,  *)
public final class ViewRenderer<Data: RenderDataType>: SynchronousRendererType {
    public typealias Block = (_ data: Data) -> UIView
    
    private let format: UIGraphicsImageRendererFormat

        self.viewCreationBlock = viewCreationBlock
    }
    
    public func renderImageWithData(_ data: Data) -> SignalProducer<UIImage, NoError> {
        return createProducer(
            data,
            viewCreationBlock: self.viewCreationBlock,
            renderBlock: { view in
                let renderer = UIGraphicsImageRenderer(
                    size: data.size,
                    format: self.format
                )
                
                return renderer.image { context in
                    draw(view: view, inContext: context.cgContext)
                }
            }
        )
    }
}

/// `RendererType` which generates a `UIImage` from a UIView.
public final class OldViewRenderer<Data: RenderDataType>: RendererType {
    public typealias Block = (_ data: Data) -> UIView
    
    private let opaque: Bool
