NSHipster touches on language features in Swift which make an external mocking library less necessary:
In Swift, classes can be declared within the definition of a function, allowing for mock objects to be extremely self-contained. Just declare a mock inner-class, override and [sic] necessary methods:
func testFetchRequestWithMockedManagedObjectContext() {
class MockNSManagedObjectContext: NSManagedObjectContext {
override func executeFetchRequest(request: NSFetchRequest!, error: AutoreleasingUnsafePointer<NSError?>) -> [AnyObject]! {
return [["name": "Johnny Appleseed", "email": "johnny@apple.com"]]
}
}
...
}
The ability to create a subclass of your external dependency in the local scope plus the addition of XCTestExpectation solve a lot of the same problems as OCMock.
The one thing that a library such as OCMock provides that is very useful are its “verify” methods to ensure that the mock classes were called. It’s possible to manually add this, but the automatic addition is nice.