Latest 1.4.3
Homepage https://github.com/EricConnerApps/SwiftyRadio
License MIT
Platforms ios 8.0, tvos 9.0, osx 10.12, requires ARC
Authors


Version
License
Platform

Installation

Manual

Just drop the SwiftyRadio.swift file into your project. That’s it!

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. To install SwiftyRadio with CocoaPods:

  1. Make sure CocoaPods is installed.

  2. Update your Podfile to include the following:

    use_frameworks!
    pod 'SwiftyRadio'
  3. Run pod install.

  4. In your code import SwiftyRadio like so:
    import SwiftyRadio

Swift Package Manager

The Swift Package Manager is a tool for managing the distribution of Swift code.

  1. Update your Package.swift file to include the following:

    import PackageDescription
    
    let package = Package(
        name: "My Radio App",
        dependencies: [
            .Package(url: "https://github.com/EricConnerApps/SwiftyRadio.git"),
        ]
    )
  2. Run swift build.

Prerequisites

In order to support background mode, append the following to your Info.plist:

<key>UIBackgroundModes</key>
<array>
    <string>audio</string>
</array>

If you want to stream from http:// URLs, append the following to your Info.plist:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

Usage

In AppDelegate.swift add the following code after imports and before @UIApplicationMain.

// Create a variable for SwiftyRadio
var swiftyRadio: SwiftyRadio = SwiftyRadio()

In ViewController.swift include the following code in viewDidLoad()

// Initialize SwiftyRadio
swiftyRadio.setup()

// Setup the station
swiftyRadio.setStation("Classic Rock 109", URL: "http://198.27.70.42:10042/stream")

// Start playing the station
swiftyRadio.play()

Handling Remote Events

In order to handle remote events, you should do the following:

In AppDelegate.swift add the following code in didFinishLaunchingWithOptions:
UIApplication.shared.beginReceivingRemoteControlEvents()

Then add the following code in applicationWillTerminate:
UIApplication.shared.endReceivingRemoteControlEvents()

Examples

Changelog

All notable changes to this project will be documented in CHANGELOG.md.

License

SwiftyRadio is available under the MIT license. See the LICENSE file for more info.

Want to help?

Got a bug fix, or a new feature? Create a pull request and go for it!

Let me know!

If you use SwiftyRadio, please let me know about your app.

Latest podspec

{
    "name": "SwiftyRadio",
    "version": "1.4.3",
    "summary": "Simple and easy way to build streaming radio apps for iOS, tvOS, & macOS.",
    "description": "SwiftyRadio is an open source cross-platform streaming radio framework with robust and professional features.",
    "homepage": "https://github.com/EricConnerApps/SwiftyRadio",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Eric Conner": "[email protected]"
    },
    "source": {
        "git": "https://github.com/EricConnerApps/SwiftyRadio.git",
        "tag": "1.4.3"
    },
    "social_media_url": "https://twitter.com/ericconnerapps",
    "platforms": {
        "ios": "8.0",
        "tvos": "9.0",
        "osx": "10.12"
    },
    "source_files": "Sources/**/*.{h,swift}",
    "requires_arc": true,
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "3.0"
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This