Skip to content

Fix clash with Foundation's Combine typealiases #163

Open
@stackotter

Description

@stackotter

For whatever reason, Apple's Foundation exposes typealiases for Combine's ObservableObject and Combine's Published.

ObservableObject typealias: https://developer.apple.com/documentation/foundation/observableobject

This means that if you import Foundation in a file that uses SwiftCrossUI's ObservableObject or Published types on an Apple platform, you'll get an ambiguous type lookup error.

There's always the workaround of specifying the full type, SwiftCrossUI.ObservableObject or SwiftCrossUI.Published, but that's annoying and also means that apps developed on Linux or Windows don't just work on macOS by default. Surprises like this that you can encounter when switching between platforms are exactly the sort of surprises we want to minimise.

That said, I don't really know what we can do about this other than using Combine's ObservableObject and Published types when on Apple platforms. This isn't ideal cause we benefit from being able to fiddle around with the internal implementations of our ObservableObject and Published types, but it's possible that we would still be able to achieve everything we need to just by adding a bit of Combine integration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions