Hey Xcode Users, I’m trying to get OCMock up and running in a small swift app and I can’t get the expectations part of the mock working. Normally in ObjC I’d write something like this:
CGRect frame = CGRectMake(0.0f, 0.0f, 320.0f, 468.0f); id mockWindow = [OCMockObject mockForClass:[UIWindow class]]; [[mockWindow expect] setFrame:frame];
I thought I might translate that to this in Swift:
var frame: CGRect = CGRectMake(0.0, 0.0, 320.0, 468.0) var mockWindow: AnyObject = OCMockObject.mockForClass(UIWindow) mockWindow.expect().setFrame(frame)
But this doesn’t work, the compiler complains with:
/Users/nick/Source/SwiftTest/SwiftTestTests/AppDelegateTest.swift:38:18: '(@lvalue CGRect) -> $T5' is not identical to ‘CGRect'
Any thoughts on what I’m doing wrong?
Cheers.
Nick |