RadioBrowserKit

develop

The Swift SDK for Radio Browser
phranck/RadioBrowserKit

RadioBrowserKit CI Carthage Compatible SwiftPM Compatible Issues Tag

RadioBrowserKit - The Swift SDK for Radio Browser

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.

Installation

RadioBrowserKit.git works with Swift 5.3 and above for iOS and macOS.

Swift Package Manager

let package = Package(
  name: "MyPackage",
  dependencies: [
    .package(url: "https://github.com/phranck/RadioBrowserKit.git", from: "0.1.0"),
  ]
)

Carthage

Put this in your Cartfile:

github "phranck/RadioBrowserKit" ~> 0.1

How to use it?

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

Developer Notes

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.

Contact

License

Creative Commons License
RadioBrowserKit by Frank Gregor is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Description

  • Swift Tools 5.6.0
View More Packages from this Author

Dependencies

Last updated: Mon Sep 16 2024 03:36:19 GMT-0900 (Hawaii-Aleutian Daylight Time)