public typealias ObservableObject = ObservableObject
Why is this seemingly pointless type alias here?
public typealias ObservableObject = ObservableObject
Why is this seemingly pointless type alias here?
You can find the actual code for this typealias in the swift-corelibs-foundation repository (where the Swift Foundation overlay lives alongside the open-source rewrite in Swift) here:
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
public typealias ObservableObject = Combine.ObservableObject
It's like @Sweeper already mentioned in his answer. Foundation exports a type from Combine this way, so that you can import Foundation and still have access to ObservableObject (without an explicit import Combine).
Note that the file that you are looking at is part of the Foundation framework, not Combine. The purpose of the type alias is to make the ObservableObject protocol available, even if you've only imported Foundation but not Combine. In short, this saves some keystrokes.
See the documentation for this type alias here. As you can see, it says that this type alias is in "Foundation", and it is a type alias for the protocol in Combine:
Also note that there is a similar type alias for the @Published property wrapper, because if you are using ObservableObjects, you are going to use @Publisher as well.