Professional Radio Station App - now supports Swift 5 / Xcode 10!

Overview

Swift Radio

Swift Radio is an open source radio station app with robust and professional features. This is a fully realized Radio App built entirely in Swift. master is now the Xcode 11.4 / Swift 5 branch.

There are over 80 different apps accepted to the app store using this code!

Swift Radio

Video

View this GETTING STARTED VIDEO. It's short & sweet to give you a quick overview.
Give it a quick watch.

Features

  • Ability to update Stations from server or locally. (Update stations anytime without resubmitting to app store!)
  • Displays Artist, Track & Album Art on Lock Screen
  • Custom views optimized for SE, 6 and 6+ for backwards compatibility
  • Compiles with Xcode 10.2 & Swift 5
  • Parses JSON using Swift Codable protocol
  • Background audio performance
  • Search Bar that can be turned on or off to search stations
  • Supports local or hosted station images
  • "About" screen with ability to send email & visit website
  • Pull to Refresh stations
  • Uses the AVPlayer wrapper library FRadioPlayer:
    • Automatically download Album Art from iTunes API
    • Parses metadata from streams (Track & Artist information)
  • Uses Spring library:
    • Animate UI components
    • Download and cache images using ImageLoader class

Important Notes

  • 4.10.19: master/carplay/dev branches migrated to Xcode 11.4/Swift 5 by @fethica.
  • 8.20.19: Add watermarked image for share activity by @CamMcLeod.
  • 5.18.19: master branch migrated to Xcode 10.2/Swift 5 by @fethica.
  • 9.4.19: Add AirPlay support by @geraldnolan.
  • 2.10.19: Add CarPlay support by @fethica -- Announcement. Branch here: carplay branch.
  • 1.30.19: Add iPad support by @misteral.
  • 1.9.19: master branch migrated to Xcode 10/Swift 4.2 by @fethica.
  • 1.21.18 Update: Swift Radio App gets a major update with Version 2 by @fethica -- Release Note.
  • 10.6.17 Update: The AVPlayer branch migrated to Xcode 9/Swift 4 by @joemcmahon. Branch here: AVPlayer Branch
  • 10.1.17 Update: Master branch migrated to Xcode 9/Swift 4 by @fethica.
  • 12.26.16 Update: The AVPlayer branch has been updated to Swift 3 by @giacmarangoni. Branch here: Xcode8/AVPlayer Branch
  • 9.20.16 Update: Master branch migrated to Xcode 8/Swift 3 by @fethica. Big thanks to him!
  • 7.26.16 Update: AVPlayer development branch added, thanks @kusikusa. Plus, this branch includes the Spotify API for downloading artwork: AVPlayer/Spotify Branch
  • 6.5.16 Update: Bluetooth streaming added, thanks @fethica
  • 3.27.16 Update: Google handoff added, thanks @GraemeHarrison
  • 2.24.16 Update: Share icon added, thanks @SuperChloe.
  • 12.30.15 Update: UISearchBar added, thanks @fethica. Turn it on/off in the "SwiftRadio-Settings" file.
  • 12.14.15 Update: LastFM has reopened their API signups. Get one at last.fm/api.
  • 10.21.15 Update: Added option to use iTunes API to download album art. (See FAQ below). iTunes art is 100px x 100px. i.e. It is smaller than LastFM artwork. So, if you use this API instead, you will want to adjust the UI of your app.
  • Volume slider works great in devices, not simulator. This is an Xcode simulator issue.
  • Radio stations in demo are for demonstration purposes only.
  • For a production product, you may want to swap out the MPMoviePlayerController for a more robust streaming library/SDK (with stream stitching, interruption handling, etc).
  • Uses Meng To's Spring library for animation, making it easy experiment with different UI/UX animations
  • SwiftyJSON & Spring are included in the repo to get you up & running quickly. It's on the roadmap to utilize CocoaPods in the future.

Credits

Created by Matthew Fecher, Twitter: @goFecher
Co-organizer Fethi El Hassasna, Twitter: @fethica
Thanks to Basel Farag, from Denver Swift Heads for the code review.

Contributions by others listed in Github here.
Thanks to everyone! We couldn't do it without you!

Requirements

  • Xcode 10.2
  • Know a little bit of how to program in Swift with the iOS SDK

Please note: I am unable to offer any free support or modifications. Thanks!

Creating an App

If you create an app with the code, or interesting project inspired by the code, shoot me an email. I love hearing about your projects!

This is just a basic template. You may use it as a clean starting point to add other features.

Some of the things I've built into this Radio code for clients include: Facebook login, Profiles, Saving Favorite Tracks, Playlists, Genres, Spotify integration, Enhanced Streaming, Tempo Analyzing, etc. There's almost unlimited things you can use this code as a starting place for. I keep this repo lightweight. That way you can customize it easily.

Setup

The "SwiftRadio-Settings.swift" file contains some project settings to get you started. Watch this Getting Started Video to get up & running quickly.

Integration

Includes full Xcode Project to jumpstart development.

Stations

Includes an example "stations.json" file. You may upload the JSON file to a server, so that you can update the stations in the app without resubmitting to the app store. The following fields are supported in the app:

  • name: The name of the station as you want it displayed (e.g. "Sub Pop Radio")

  • streamURL: The url of the actual stream

  • imageURL: Station image url. Station images in demo are 350x206. Image can be local or hosted. Leave out the "http" to use a local image (You can use either: "station-subpop" or "http://myurl.com/images/station-subpop.jpg")

  • desc: Short 2 or 3 word description of the station as you want it displayed (e.g. "Outlaw Country")

  • longDesc: Long description of the station to be used on the "info screen". This is optional.

Contributions

Contributions are very welcome. Please check out the dev branch, create a separate branch (e.g. features/3dtouch). Please do not commit on master.

FAQ

Q: Do I have to pay you anything if I make an app with this code?
A: Nope. This is completely open source, you can do whatever you want with it. It's usually cool to thank the project if you use the code. Go build stuff. Enjoy.

Q: How do I make my app support ipv6 networks?
A: For an app to be accepted by Apple to the app store as of June 1, 2016, you CAN NOT use number IP addresses. i.e. You must use something like "http://mystream.com/rock" instead of "http://44.120.33.55/" for your station stream URLs.

Q: Is there an example of using this with the Spotify API?
A: Yes, there is a branch here that uses it here ( ⚠️ deprecated).

Q: Is there another API to get album/track information besides LastFM, Spotify, and iTunes?
A: Rovi has a pretty sweet music API. The Echo Nest has all kinds of APIs that are fun to play with.

Q: I updated the album art size in the Storyboard, and now the sizing is acting funny?
A: There is an albumArt constraint modified in the code. See the "optimizeForDeviceSize()" method in the NowPlayingVC.

Q: My radio station isn't playing?
A: Paste your stream URL into a browser to see if it will play there. The stream may be offline or have a weak connection.

Q: Can you help me add a feature? Can you help me understand the code? Can you help with a problem I'm having?
A: While I have a full-time job and other project obligations, I'd highly recommend you find a developer or mentor in your area to help. The code is well-documented and most developers should be able to help you rather quickly. While I am sometimes available for paid freelance work, see below in the readme, I am not able to provide any free support or modifications. Thank you for understanding!

Q: The song names aren't appearing for my station?
A: Check with your stream provider to make sure they are sending Metadata properly. If a station sends data in a unique way, you can modify the way the app parses the metadata, in the RadioPlayer class implement FRadioPlayerDelegate method: radioPlayer(_ player: FRadioPlayer, metadataDidChange rawValue: String?).

Get Single Station Code

If you'd like to support this project, co-organizer Fethi has created a well-architected single station version of this code. It's a super great bargain: The developers behind this project typically charge up to $200/hr for freelance work, but this fully working code is only $50. No extra fees.

You can PayPal: [email protected] or use this link: Paypal Me We will send you the code after 24 hours with setup instructions. All funds go to support the project.

Need something more advanced? We have recent experience building iOS apps for high-profile brands. Send a friendly email to Matthew or Fethi.

RadioKit SDK Example

alt text

  • You can use this Swift code as a front-end for a more robust streaming backend.
  • Brian Stormont, creator of RadioKit, has created a branch with the professional RadioKit SDK already integrated. Plus, his branch adds rewind & fast forward stream playback. This is an excellent learning tool for those who are interested in seeing how a streaming library integrates with Swift Radio Pro. View the branch here.

Custom Work & Consulting

We have recent experience building iOS apps for both independent and high-profile clients (brand names and apps we can't discuss here, but, you would instantly recognize!) Additionally, we've built advanced versions of this radio code for amazing independent clients.

Get in Touch to see what I can do for you!

Comments
  • Switching from WiFi to 3G/4G/LTE and vice versa gets the station playing stuck in stop mode.

    Switching from WiFi to 3G/4G/LTE and vice versa gets the station playing stuck in stop mode.

    I've noticed when you are listening to a station and you move from WiFi to 3G/4G/LTE or vice versa that the station will stop and the only way to get it to come back is to press the STOP button and then play again. Is there anyway we can have the station thats playing to auto restart once DATA is re-established? Other than that I love it, great work guys.

    opened by mannyd209 16
  • Error compiling

    Error compiling

    Hello, give me these errors when compiling the application from products -> Archive

    Check dependencies

    Failed to create provisioning profile. There are no devices registered in your account on the developer website. Plug in and select a device to have Xcode register it.

    No profiles for 'XXX' were found: Xcode couldn't find a provisioning profile matching 'XXX'.

    Code signing is required for product type 'Application' in SDK 'iOS 10.3'

    What is the problem?

    opened by Gharveys 12
  • Thanks to everyone for an amazing 2016!

    Thanks to everyone for an amazing 2016!

    Hey everyone! They say "build it, and they will come". However, as you all know, that is not always the case with open-source projects. This project started as a fun little excuse for me to practice and learn Swift (coming from Obj-C). It would have probably just stayed on my hard drive, if it were not for @Jxrgxn's encouragement to make it public on Github.

    Fast forward to a little over a year later, and it's been starred over 1,500+ times, 300+ branches, and there are over 80+ apps in the app store (that I know about). Most of the apps are in foreign (non-USA) app stores.

    I'd like to extend a gracious and heartfelt thanks to everyone who contributed!

    Your contributions are directly responsible for dozens of apps being created and distributed across the world (that may have otherwise never seen the light of day). At least two people have emailed me that they received jobs because of this code. So, you're also helping people earn a livelihood and improving the world a little at a time, through code.

    I wanted to publicly THANK all the awesome people who contributed (alphabetical order by username):

    @eaconner @fethica @giacmarangoni @Jonahss @Jxrgxn @naoyashiga @phatblat @rajabishek @RealBug @SuperChloe @WadeSellers

    Also, big thanks to everyone who used the code, and helped others with the project!

    opened by analogcode 10
  • Now Playing Album Artwork

    Now Playing Album Artwork

    Hey guys I'm trying to get the Now Playing album artwork to pull from our station RDS. I was able to implement it in a "Recently Played" view controller that I added. See the video that I attached. ScreenRecording

    So is there a way to have the now playing pull the artwork URL from our station RDS? If not then is there a way to have the now playing pull an image from a URL if a certain Artist or Album is currently playing? The reason for this is we have guest DJs that mix for an hour each day and we would like to show their image while they are in the mix.

    Thanks guys

    opened by mannyd209 9
  • Fix a crash when fetching stations & offline

    Fix a crash when fetching stations & offline

    Scenario:

    • device is offline
    • station JSON is being loaded from a remote file
    • load fails
    • application crashes

    Fix:

    • change the check in StationsViewController to verify that the station count is > 0 before trying to update the table view. Pull-to-refresh is still enabled, so the app remains responsive until the network connection is reestablished and the JSON can be downloaded.
    opened by joemcmahon 8
  • iOS 13 changes trying to fix the code...

    iOS 13 changes trying to fix the code...

    A few warning started popping up after updating the Xcode, app still loads but i been trying to troubleshoot them with no luck... any and all help appreciated thanks! - im trying to deploy to iOS 13 since now apple store requires it after april 30th

    first the nav bar now is gray can't seem to be able to change it back to black (or any other color)

    Swift Compiler Warning Group /Users/dylan/Apps/8Parole/SwiftRadio/StationsViewController.swift:153:30: 'isNetworkActivityIndicatorVisible' was deprecated in iOS 13.0: Provide a custom network activity UI in your app if desired.

    /Users/dylan/Apps/8Parole/SwiftRadio/StationsViewController.swift:160:65: 'isNetworkActivityIndicatorVisible' was deprecated in iOS 13.0: Provide a custom network activity UI in your app if desired.

    /Users/dylan/Apps/8Parole/SwiftRadio/StationsViewController.swift:374:26: 'dimsBackgroundDuringPresentation' was deprecated in iOS 12.0

    /Users/dylan/Apps/8Parole/SwiftRadio/Libraries/FRadioPlayer/FRadioPlayer.swift:525:37: 'timedMetadata' was deprecated in iOS 13.0: Use AVPlayerItemMetadataOutput to obtain timed metadata

    /Users/dylan/Apps/8Parole/SwiftRadio/Libraries/Spring/KeyboardLayoutConstraint.swift:63:46: 'keyWindow' was deprecated in iOS 13.0: Should not be used for applications that support multiple scenes as it returns a key window across all connected scenes

    /Users/dylan/Apps/8Parole/SwiftRadio/Libraries/Spring/KeyboardLayoutConstraint.swift:92:46: 'keyWindow' was deprecated in iOS 13.0: Should not be used for applications that support multiple scenes as it returns a key window across all connected scenes

    opened by losgranos 7
  • Connected to json.

    Connected to json.

    I have uploaded the json file to a server, and when I update it it show on the web its updated but it doesn't reflect the update on the app. It takes a very long time to reflect the update in simulator but never does when I run the app on a physical device unless I delete the app and re-run agin.

    Anyway to fix this and reflect the updates to the json file when they happen?

    Thanks

    PS: Pull to refresh doesn't do anything for this issue, neither killing the app.

    opened by RiverRaid84 7
  • NSErrorFailingURLStringKey

    NSErrorFailingURLStringKey

    Hi, any idea ? url is working but player cant play it NSErrorFailingURLStringKey=http://nashe1.hostingradio.ru/best-128.mp3

    load failed with error Error Domain=NSURLErrorDomain Code=-999 "cancelled

    opened by brdn 6
  • .ogg streams are not working

    .ogg streams are not working

    Recently I was working on a sample streaming project & realised that .ogg streams are not woking.

    Is there a solution for that? or else this project doesn't support .ogg streams??

    opened by dilumn 6
  • AppleAir play xcode 8.1

    AppleAir play xcode 8.1

    Hello, did you plan to implement AirPlay in the project? It would be really fantastic. If not, will you convert the single radio project to swift 3 xcode 8.1? thank you very much

    opened by RomainDev25 6
  • updates - avplayer - spotify

    updates - avplayer - spotify

    Hi, thanks for sharing this, it was very useful to me. I've made a couple of changes: switching to AVPlayer because MPMoviePlayerController is deprecated in IOS9 and adding Spotify as a cover API.

    It's my first time contributing to anything, I'm not entirely sure I'm doing it right.

    Regards, Xavier

    opened by kusikusa 6
  • Apple rejected by guideline 5.2.3

    Apple rejected by guideline 5.2.3

    Hi, I submitted on the AppStore ( with API) and apple rejected my app with this guideline, how can I solve it?

    here is the message:

    Regarding 5.2.3, we still find that your app contains content or features that may violate the rights of one or more third parties. Specifically, your app provides potentially unauthorized access to third-party audio or video streaming, catalogs, and discovery services.

    

To resolve this issue, it would be appropriate to attach documentary evidence in the App Review Information section in App Store Connect evidencing that you have all necessary rights or permissions to the third-party audio or video streaming, catalogs, and discovery services in your app

    question 
    opened by Mohsenkhodadadzadeh 16
  • Radio Pro Android version

    Radio Pro Android version

    Just wondering if any of these geniuses designed an android version of the radio... Something that looks just like this one, its so simple yet so functional... just wondering... thanks! Juan

    question 
    opened by losgranos 1
  • Single App Mode issues

    Single App Mode issues

    Hey guys, I'm having an issue when I set my iOS device to SUPERVISED with an Apple DEP account and start single app mode with Apple Configurator 2. The iOS device just shows a blank screen. I was wondering if maybe there is something that needs to be put in the App.Delegate or something like that so the app knows it's in Single App Mode. I don't know for sure but it's an idea. Please help if anyone knows what needs to be done. Thanks

    help wanted 
    opened by mannyd209 0
  • Interruption Handling Notifications not working

    Interruption Handling Notifications not working

    private func setupNotifications() {

    let notificationCenter = NotificationCenter.default notificationCenter.addObserver(self, selector: #selector(handleInterruption), name: AVAudioSession.interruptionNotification, object: nil) notificationCenter.addObserver(self, selector: #selector(handleRouteChange), name: AVAudioSession.routeChangeNotification, object: nil) notificationCenter.addObserver(self, selector: #selector(playerDidFinishPlaying), name: .AVPlayerItemDidPlayToEndTime, object: nil)

        notificationCenter.addObserver(self, selector: #selector(playerDidRecieveError(_:)), name: .AVPlayerItemNewErrorLogEntry, object: nil)
    
         notificationCenter.addObserver(self, selector: #selector(playerDidRecieveError(_:)), name: .AVPlayerItemFailedToPlayToEndTime , object: nil)
    
        notificationCenter.addObserver(self, selector: #selector(playerDidRecieveError(_:)), name: .AVPlayerItemPlaybackStalled , object: nil)`
    

    }

    I added 3 more notifications for interruption handling, but seems not to be working please help with this issue @analogcode @fethica

    help wanted 
    opened by Kedar-27 2
  • Cannot restore radio

    Cannot restore radio

    1. Go to app
    2. Start to Play any radio, then press Stop.
    3. Swipe from top and enable Flight Mode
    4. Return to app and press Play, then Stop.
    5. Swipe from top and disable Flight Mode
    6. Return to app and press Play/Stop - nothing happens.
    opened by andrey-lisovskiy 5
Releases(2.0.8)
Owner
Matthew Fecher
iOS Developer/Designer. Co-Founder of AudioKit Pro. Tech Editor, "iPhone For Dummies". Twitter @analogMatthew
Matthew Fecher
The official OS X client to the Radio Paradise web radio.

Introduction Radio Paradise is a unique blend of many styles and genres of music, carefully selected and mixed by two real human beings — enhanced by

Giacomo Tufano 19 Aug 17, 2022
Radio & Podcast Streaming App For WPRK

WPRK(iOS & iPadOS) Radio & Podcast Streaming App For WPRK, a licensed FCC broadcast station, The app allows users to connect to live music streams and

MwaiBanda 5 May 30, 2022
PTStations - MacOS App to gather the information on the Train Station of the Portuguese Railway system

PTStations A simple macOS app that gathers information on the Portuguese Railway

Joao Pires 2 Aug 10, 2022
Radio Streams from all over the world. Free and Open.

RadioBrowserKit - The Swift SDK for Radio Browser Radio Streams from all over the world. Free and Open. RadioBrowserKit is a Swift package which lets

Frank Gregor 5 Oct 17, 2022
'Minimalistic Push' is a minimalistic push-up application now built with Flutter.

Minimalistic Push Minimalistic Push is one of the simplest push-up trackers out there. You can track your push-ups in the training mode and see an ove

Jonas Poxleitner 10 Dec 29, 2022
Swift Xcode Project that demonstrates how to set up a microphone input via AudioKit verions 5.

AudioKit Mic Input Swift Xcode Project that demonstrates how to set up a microphone input via AudioKit verions 5. Be sure to plug in headphones in ord

Mark Jeschke 0 Oct 23, 2021
AIB indicates for your app users which audio is playing. Just like the Podcasts app.

Audio Indicator Bars for iOS and tvOS Indicates for your app users which audio is playing. Just like the Podcasts app. Index Requirements and Details

Leonardo Cardoso 285 Nov 23, 2022
An iOS app that visually clones Spotify's app and consumes the official Spotify's Web API to show(and play) songs, podcasts, artists and more.

SpotifyClone An iOS app that visually clones Spotify's app and consumes the official Spotify's Web API to show(and play) songs, podcasts, artists and

null 104 Jan 7, 2023
Voice Memos is an audio recorder App for iPhone and iPad that covers some of the new technologies and APIs introduced in iOS 8 written in Swift.

VoiceMemos Voice Memos is a voice recorder App for iPhone and iPad that covers some of the new technologies and APIs introduced in iOS 8 written in Sw

Zhouqi Mo 322 Aug 4, 2022
A simple Spotify lyrics viewer menu bar app for macOS in Swift 3

lyricsify This is a simple macOS menu bar application that shows you the lyrics of current playing spotify track. All the lyricses are from Wikia webs

Mohamad Jahani 85 Dec 31, 2022
The easiest way to prepare, play, and remove sounds in your Swift app!

Chirp The easiest way to prepare, play, and remove sounds in your Swift app! ##Installation ###CocoaPods Installation Chirp is available on CocoaPods.

null 309 Dec 17, 2022
A pure Swift Spotify Music App in Apple Music style

HBMusic A pure Swift Spotify Music App in Apple Music style. How to run pod inst

haoboxuxu 6 Dec 29, 2021
HomeHub - Swift app to control my home's smart devices + show spotify current playback

HomeHub iPad app to control my home's smart devices + show spotify current playb

Cooper Bell 2 Oct 22, 2022
NetflixStyleSampleApp - Netflix Style Sample App With Swift

NetflixStyleSampleApp Description Nexflix 앱을 참고하여 영화 콘텐츠를 보여주는 샘플 앱을 제작하느 프로젝트이다

null 0 Feb 2, 2022
Sentiments is an iOS app written in Swift that analyzes text for positive or negative sentiment

Sentiments Sentiments is an iOS app written in Swift that analyzes text for positive or negative sentiment. Positive sentiment is highlighted in green

Kyle Weiner 177 Nov 16, 2022
AudioKit 67 Dec 21, 2022
GuitarPractice - Guitar Practice app built with swift

Guitar Practice I am the sole developer and designer of this application. This i

Karl Stencell 1 Feb 7, 2022
KeyAudioManager - A swift package to make it a lot easier to play audio in your app

KeyAudioManager A swift package to make it a lot easier to play audio in your ap

Pedro Esli 3 Apr 28, 2022
Swift-music - swift-music is a swift package that provides an easy-to-use API for music related developments.

?? swift-music Introduction swift-music is a swift package that provides an easy-to-use API for music related developments. Currently available module

Jin Zhang 4 Feb 8, 2022