Skip to content

CALayer & Objective-C support ✅

Compare
Choose a tag to compare
@skyweb07 skyweb07 released this 25 Nov 14:31

What

  • Added support for checking for CALayers, now you can use the same pattern that for view checking
func test_box_with_gradient_layer() {
  let layer = CAGradientLayer()
  layer.frame = CGRect(x: 0, y: 0, width: 100, height: 100)
 
  expect(layer).toMatchSnapshot()
}
  • Added Objective-C compatibility and it's as easy as swift
@import XCTest;
#import <Snap_swift/Snap_swift-swift.h>
#import <Snap_swift/Snap.h>

@interface SnapTests : XCTestCase
@end

@implementation SnapTests
 
- (void)test_box_with_text_aligned_to_center {

  UIView *view = [BoxWithTextAlignedToCenterView new];
  
  verifyView(view); // or verifyLayer if it's a CALayer subclass
}

@end