Int = 0) { self.num = num } var numSetCallCount = 0 var underlyingNum: Int = 0 var num: Int { get { return underlyingNum } set { underlyingNum = newValue numSetCallCount += 1 } } ... } public class FooMock: Foo { ... var barCallCount = 0 var barHandler: ((Float) -> (String))? func bar(arg: Float) -> String { barCallCount += 1 if let barHandler = barHandler { return barHandler(arg) } return "" } }
= StringProtocol) public protocol Foo { associatedtype T associatedtype U: Collection where U.Element == T associatedtype W ... } public class FooMock: Foo { typealias T = AnyObject // overriden typealias U = StringProtocol // overriden typealias W = Any // default placeholder type for typealias ... }