Learning about Swift headers I see this pattern used by Apple, specifically the init declaration of the following HAS NO IMPLEMENTATION structure. Obviously, the implementation of init () is hidden somehow since it is Apple, but I was trying to figure out how to do it. This is just an example, but it looks like the general behavior in the headers
struct AutoreleasingUnsafePointer<T> : Equatable, LogicValue { let value: Builtin.RawPointer init(_ value: Builtin.RawPointer)
I know that you can declare a protocol plus an extension of the class, doing this to βhideβ the implementation from the class declaration and move it to another place
class TestClass :TestClassProtocol {
But this is different from what I saw in the Apple headers, as the "declaration" method is inside the "class" and not inside the "protocol". however, if I try to place a method declaration inside the TestClass class, I have two errors (a function without a body in the class and an invalid re-declaration on the extension)
In Objective-C, this was "implicit" since the method declaration was in .h and implementation in .m. How to do the same in Swift?
ios swift
Lombax
source share