我在想如何用Swift重写下面的Objective-C单元测试:

- (void)testSuperclass {
    Class superclass = [self.animatedView superclass];
    Class expectedSuperclass = [BREAnimatedView class];
    XCTAssertEqualObjects(superclass, expectedSuperclass);
}

最佳答案

我想你可以

func testSuperclass() {
    val superclass = self.animatedView.superclass
    val expectedSuperclass = BREAnimatedView.class()
    XCTAssertEqualObjects(superclass, expectedSuperclass)
}

但我很高兴看到有没有更好的办法。

10-07 16:15