Last active
June 19, 2020 10:12
-
-
Save kraigspear/519e2021910f86910c0b413b2876e86c to your computer and use it in GitHub Desktop.
Adding a publisher to a protocol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol VehicleDataLoadable { | |
var vehiclePublisher: Published<Vehicle?>.Publisher { get } | |
} | |
final class VehicleDataLoader: VehicleDataLoadable { | |
@Published var vehicle: Vehicle? | |
var vehiclePublisher: Published<Vehicle?>.Publisher { $vehicle } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment