To run the example projects, clone the repo, and run
pod install from the example project directory first.
Just drop the SwiftyRadio.swift file into your project. That's it!
CocoaPods is a dependency manager for Cocoa projects. To install SwiftyRadio with CocoaPods:
Make sure CocoaPods is installed.
Update your Podfile to include the following:
ruby use_frameworks! pod 'SwiftyRadio'
In your code import SwiftyRadio like so:
Swift Package Manager
The Swift Package Manager is a tool for managing the distribution of Swift code.
Package.swiftfile to include the following:
```swift import PackageDescription
let package = Package( name: "My Radio App", dependencies: [ .Package(url: "https://bitbucket.org/ericconnerapps/swiftyradio.git"), ] ) ```
In order to support background mode, append the following to your
<key>UIBackgroundModes</key> <array> <string>audio</string> </array>
If you want to stream from
http:// URLs, append the following to your
<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict>
AppDelegate.swift add the following code after imports and before
// Create a variable for SwiftyRadio var swiftyRadio: SwiftyRadio = SwiftyRadio()
ViewController.swift include the following code in
// Initialize SwiftyRadio swiftyRadio.setup() // Setup the station swiftyRadio.setStation("Classic Rock 109", URL: "http://220.127.116.11:10042/stream") // Start playing the station swiftyRadio.play()
Handling Remote Events
In order to handle remote events, you should do the following:
AppDelegate.swift add the following code in
Then add the following code in
All notable changes to this project will be documented in CHANGELOG.md.
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.