BaiduFM-Swift
June 11, 2025 · View on GitHub
A Baidu FM client implemented in Swift, based on the latest Xcode 6.3 + Swift 1.2. This project was initially focused on implementing basic functionality, and the code may be rough in some areas. I plan to refactor and optimize it when time permits.
API Disclaimer
- This app uses Baidu FM's non-public API. All music copyrights belong to Baidu.
Features
- Apple Watch support (synchronized lyrics display)
- Download songs to local storage (with delete functionality)
- Favorite music management (add/remove favorites)
- Recently played music history (with clear functionality)
- Pull-to-refresh and load more songs
- Auto-scrolling lyrics
- Real-time playback progress display
- Play/pause control
- Previous/next track navigation
- Music category browsing
- Categorized song lists
- Background playback support
- Lock screen album artwork and song info display
- Lock screen music controls (next/previous, play/pause)
- Favorites list, recently played list, and downloaded songs list
Screenshots
-
Apple Watch Home

-
Apple Watch Menu

-
Apple Watch Song List

-
Apple Watch Category Selection

-
iPhone Lock Screen Display & Controls

-
iPhone Home Screen

-
iPhone Music Categories

-
iPhone Song List

Third-Party Libraries
- Alamofire - Networking library
- SwiftyJSON - JSON parsing
- FMDB - SQLite database wrapper
- Async - Asynchronous programming
- MJRefresh - Pull-to-refresh
- LTMorphingLabel - Text animation effects
- Kingfisher - Image caching and downloading
Swift Concepts Used
- Network requests
- JSON parsing
- Swift regular expressions
- Swift singleton pattern
- Pull-to-refresh & load more with MJRefresh
- Song progress with UIProgressView
- Lyrics scrolling with UITextView
- Closures
- Property observers (get, set, didSet)
- Online MP3 playback using MPMoviePlayerController
- NSNotificationCenter for data passing
TODO Features
- Replace music playback with AVAudioPlayer
- Enhanced Apple Watch support
