Radio Streams from all over the world. Free and Open.
RadioBrowserKit is a Swift package which lets you use the free and Open Source Radio Browser API.
RadioBrowserKit.git
works with Swift 5.3 and above for iOS and macOS.
let package = Package(
name: "MyPackage",
dependencies: [
.package(url: "https://github.com/phranck/RadioBrowserKit.git", from: "0.1.0"),
]
)
Put this in your Cartfile
:
github "phranck/RadioBrowserKit" ~> 0.1
The first thing you have to do is create an instance of the RadioBrowser
class. This can be done at the beginning of your app launch. For SwiftUI you can provide it as an environment object via view modifier.
@main
struct MyApp: App {
@StateObject var radioBrowserApi = RadioBrowser()
var body: some Scene {
WindowGroup {
MainView()
.environmentObject(radioBrowserApi)
}
}
}
Actually RadioBrowser
publishes four observed properties which you can use in your SwiftUI view automatic refreshing (a RadioBrowserDelegate
to use it in a UIKit app will follow later):
@Published public internal(set) var stations: [Station] = []
@Published public internal(set) var favorites: [Station] = []
@Published public internal(set) var isLoading: Bool = false
RadioBrowserKit
uses GitFlow. There are two branches, main
and develop
. The develop
branch is the default branch. To provide (changes|fixes|additions) you just have to fork this repository and create your working branch with develop
as base. If you’re done, just open a pull request.
RadioBrowserKit by Frank Gregor is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.