This repository contains a demo application that illustrates how to use the FeedMedia iOS SDK to build a simple app that streams music. It is meant as a reference integration: a small, readable SwiftUI project you can read top-to-bottom to see how the SDK is configured, how playback is driven, and how the standard iOS "now playing" experience (lock-screen controls, artwork, and background audio) is wired up.
| Path | Description |
|---|---|
iOS-SDK-Demo.xcworkspace |
The workspace to open in Xcode. |
Simple/ |
The Simple demo app — a SwiftUI "Feed Radio" client. |
Simple/Sources/ |
App source. |
Simple/Tests/ |
Unit tests for the app's plain-Swift helpers. |
The FeedMedia SDK is pulled in via Swift Package Manager from
https://github.com/feedfm/iOS-SDK (pinned in
iOS-SDK-Demo.xcworkspace/xcshareddata/swiftpm/Package.resolved). There is
nothing to install by hand — Xcode resolves the package on first open.
Simple is a one-screen SwiftUI music app that:
- Lists the stations available to the 'demo' Feed.fm account.
- Plays, pauses, and skips tracks, and likes / dislikes the current song.
- Shows a mini player bar that expands into a full-screen player.
- Renders per-station artwork (a remote image when the station provides one, otherwise a generated brand-gradient + waveform fallback).
- Keeps playing in the background and drives the lock-screen "Now Playing" interface — metadata, artwork, and remote play / pause / skip / like / dislike controls.
The SDK does the heavy lifting (streaming, the AVAudioSession, lock-screen
metadata, and remote commands); the app is mostly thin UI plus a single
observable store that bridges SDK notifications to SwiftUI state.
| File | Role |
|---|---|
SimpleApp.swift |
App entry point. Sets the client token, configures the AVAudioSession (.playback) so the app owns the lock-screen controls, and waits for the player to become available. |
PlayerStore.swift |
@Observable wrapper around FMAudioPlayer.shared(). Subscribes to the SDK's notifications, exposes display state + playback intents to the UI, and renders lock-screen artwork. |
RootView.swift |
Composes the station list with the mini bar and the expanding full player. |
StationListView.swift, StationRow.swift |
Station browsing UI. |
MiniBarView.swift, FullPlayerView.swift |
Playback UI. |
MarqueeText.swift |
SwiftUI wrapper around the SDK's FMMarqueeLabel; text scrolls when too wide to fit, stays static otherwise. |
MetadataFormat.swift |
Pure helper that joins artist and album into one display line. |
DisclaimerView.swift |
Music licensing disclaimer sheet, opened from the "Powered by Feed.fm" attribution in the full player. |
RadioStation.swift |
A display model decoupled from the SDK's FMStation, built from a plain options dictionary so it's easy to test. |
ArtworkView.swift, Waveform.swift, FRTheme.swift |
Artwork rendering and theming. |
TimeFormat.swift |
Elapsed / remaining time formatting. |
If you're integrating the SDK into your own app, these are the parts to read first:
- Credentials —
FMAudioPlayer.setClientToken(_:secret:)inSimpleApp.swift. - Availability —
FMAudioPlayer.shared().whenAvailable(_:notAvailable:)gates the UI until the player (and station list) is ready. - Playback —
setActiveStation(_:withCrossfade:),play(),pause(),skip(),like(),dislike()inPlayerStore.swift. - State — the app listens to
FMAudioPlayer*notifications (playback state, current item, elapsed time, skip/like status, active station) rather than polling. - Lock screen & background audio — the SDK manages metadata and remote
controls; the app declares the
audioUIBackgroundMode(Sources/Info.plist) and supplies artwork viasetLockScreenImage(_:).
- Xcode 16 or later
- iOS 17.0+ deployment target
- Swift 6 language mode
- A Feed.fm client token and secret
- Open
iOS-SDK-Demo.xcworkspacein Xcode. - Wait for Swift Package Manager to resolve the
iOS-SDKpackage. - Select the Simple scheme and an iOS 17+ simulator or device.
- Build and run (⌘R).
The demo ships with the placeholder credentials "demo" / "demo" (see
SimpleApp.swift). To stream your own catalog, replace them with the client
token and secret from your Feed.fm account.
From Xcode, press ⌘U with the Simple scheme selected, or from the command line:
xcodebuild \
-workspace iOS-SDK-Demo.xcworkspace \
-scheme Simple \
-destination 'platform=iOS Simulator,name=iPhone 17' \
test