Cool Animated music indicator view written in Swift

Overview

GA

Cool Animated music indicator view written in Swift.

ESTMusicIndicator is an implementation of NAKPlaybackIndicatorView in Swift for iOS 8.

MusicIndicator

You may interested in my other project

Requirements

  • An iPhone/iPad running iOS 8.0+
  • Xcode 7.0 or above

Screenshots

MusicIndicator

Run the Demo

$ open Example/ESTMusicIndicator.xcodeproj

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

CocoaPods 0.36 adds supports for Swift and embedded frameworks. You can install it with the following command:

$ gem install cocoapods

To integrate ESTMusicIndicatorView into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'ESTMusicIndicator'

Then, run the following command:

$ pod install

You can check out this link for more information about how to use CocoaPods.

Manually

  1. Clone this project or download it.
  2. Drag and drop Classes folder to your workspace

Usage

Simple Example:

let indicator = ESTMusicIndicatorView.init(frame: CGRect.zero)
indicator.tintColor = .red
indicator.sizeToFit()
view.addSubview(indicator)

Initially the state property is ESTMusicIndicatorViewStateStopped and the hidesWhenStopped property is YES. Thus, the view is hidden at this time.

The view appears and the bars start animation.

indicator.state = .playing;

The bars stop animation and become idle.

indicator.state = .paused;

The view becomes hidden.

indicator.state = .stopped;

You can use ESTMusicIndicatorView in both code and Storyboard, and it works well with both Auto Layout and frame-based layout.

Code with Auto Layout

let indicator = ESTMusicIndicatorView.init(frame: CGRect.zero)
indicator.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(indicator)

Then, add some positioning layout constraints. Note that normally you don't need to add sizing constraints since ESTMusicIndicatorView has an intrinsic content size. It will be automatically resized to fit its content.

Code with Frame-Based Layout

let indicator = ESTMusicIndicatorView.init(frame: CGRect.zero)
view.addSubview(indicator)
indicator.sizeToFit() // Resize itself to fit its content.

Customization

Color

The color of the bars can be changed by setting tintColor property (UIView) of the view or its ancestor view.

Size

Normally the view can be automatically resized to fit its content by:

  • Omitting sizing constraints in Auto Layout, since it has an intrinsic content size.
  • Calling sizeToFit in frame-based layout.

Or if you explicitly specify size, the bars will be placed in the center of the view.

Contact

You can ping me on Twitter or follow me on Weibo If you find an issue.

Contributing

Thank you for your interest in contributing to Hodor! Your ideas for improving this app are greatly appreciated. The best way to contribute is by submitting a pull request. I'll do my best to respond to you as soon as possible. You can also submit a new GitHub issue if you find bugs or have questions.

Thanks for

License

Copyright (c) 2017-2018 Paul King

Released under the MIT license

Comments
  • Help!

    Help!

    Hello! Your program is very well done. Thanks very much for you sharing,but I found a problem in the test. In this program you have set up ten rows of data,and it works well.But if I set up more rows of data,for example eighty rows, when it works,I click on the first line,I find the first line,the fifteenth line ,the twenty-ninth line,the forty-third line,the fifty-seventh line and the seventy-first line indicators are all Animating. This is wrong,Please help!

    opened by liuyiyi2016 2
  • Mark NSNotification callback methods with @objc.

    Mark NSNotification callback methods with @objc.

    Currently the app crashes with 'unrecognized selector sent to instance' exception. Mark applicationWillEnterForeground: method with @objc so method is exposed to Objective-C.

    Stop all animations explicitly in new applicationDidEnterBackground: method so it logically pairs with applicationWillEnterForeground: . Also it works great if animations are not suspended by Apple for some reason/different iOS version.

    opened by genkernel 2
  • Remove kBarMin/MaxPeakHeight constants and use view's height as maxPeakHeight.

    Remove kBarMin/MaxPeakHeight constants and use view's height as maxPeakHeight.

    Use frame's height value as maxPeakHeight to allow developer to resize ESTMusicIndicator externally(e.g. storyboard) without changing internal constants.

    opened by genkernel 2
  • migrated to swift 4

    migrated to swift 4

    • updated project settings
    • changed UILayoutPriorityDefaultHigh to UILayoutPriority.defaultHigh
    • changed SWIFT_SWIFT3_OBJC_INFERENCE to default in target settings
    • added @objc to didTapIndicator gesture recognizer
    opened by helkarli 1
  • Ability to change number of bars

    Ability to change number of bars

    kBarCount is a constant. It would be really nice to be able to change that. In our app, in one place we'd like 3 bars, in another place we'd like 4 bars.

    opened by hipwelljo 1
  • iOS 10 issue

    iOS 10 issue

    @Aufree
    Hello, I have 20 static cells in table view and when state == .playing and bars are animating and when I scroll down and go up bars are no longer animating and they in pause mode iOS 8.4 has no problems with it Any idea how can I fix this ?

    Thanks!

    opened by yarodevuci 3
Owner
Aufree
Live a life you will remember.
Aufree
Recording Indicator Utility lets you turn off the orange microphone recording indicator light for live events and screencasts.

Recording Indicator Utility Recording Indicator Utility lets you turn off the orange microphone recording indicator light, making it ideal for profess

Tyshawn Cormier 121 Jan 1, 2023
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
Classical music front-end for Apple Music: iOS app

concertino_ios Concertino is a classical music front-end for Apple Music. It's splitted in several projects. This one provides only the iOS app. (Ther

Open Opus 107 Dec 22, 2022
iOS music player app that downloads music from the internet, even YouTube

About YouTag is an iOS music player app that downloads music from the internet, even YouTube, and manages it in a local library. Music videos can also

null 263 Jan 8, 2023
🅿️ PandoraPlayer is a lightweight music player for iOS, based on AudioKit and completely written in Swift.

Made by Applikey Solutions Find this project on Dribbble Table of Contents Purpose Features Supported OS & SDK Versions Installation Usage Demo Releas

Applikey Solutions 1.1k Dec 26, 2022
Fully functional music player which is written in swift programming language

Music Player Source Code Fully functional Music Player Application Source code that is written in Swift 4.1, Xcode 9.3 Introduction Music Player for i

bpolat 243 Nov 9, 2022
Custom iOS music player view

InteractivePlayerView Custom iOS music player view Screen About InteractivePlayerView is an IBDesignableView (Custom View) which has its own progress,

AhmetKeskin 273 Nov 11, 2022
A small project written with SwiftUI achieves a scrolling effect similar to Apple Music lyrics.

Music Lyrics scrolling animation effect Since the iOS/iPadOS 13 update, Apple has brought a new scrolling lyrics feature to Apple Music. The album im

Huang Runhua 18 Nov 9, 2022
Replace the system volume popup with a more subtle indicator.

Replace the volume popup with a more subtle way to display the volume when the user changes it with the volume rocker. Why and how The iOS default pop

Andrea Mazzini 1.2k Nov 21, 2022
MusicKit is a framework and DSL for creating, analyzing, and transforming music in Swift.

MusicKit MusicKit is a framework and DSL for creating, analyzing, and transforming music in Swift. Examples Functional harmony let C5 = Pitch(midi: 72

Ben Guo 591 Oct 18, 2022
Analyser BPM in Swift for your music/sounds/records, whatever..

BPM-Analyser Analyser BPM in Swift for your music/sounds/records, whatever.. Powered with Superpowered Preview: How To: Copy theese files to your proj

Gleb Karpushkin 71 Dec 24, 2022
Music Player NBC With Swift

MusicPlayer Xcode command + shift + Y -> Debug 창 띄우기 command + R -> App 실행 command + . -> App 중지 ctrl + option + commadn + return(enter) -> Assistant

davidyoon891122 0 Nov 27, 2021
MusicTheoryKit: a swift module that provides an easy-to-use API for most commonly used music terms

MusicTheoryKit Introduction MusicTheoryKit is a Swift framework that provides an easy-to-use API for most commonly used music terms. Create notes, ass

Jin Zhang 4 Feb 8, 2022
MusicScore - A music score library with MusicPart, Measure, Note, Pitch and Tempo representations in swift structs

MusicScore A music score library with MusicPart, Measure, Note, Pitch and Tempo

null 7 Sep 19, 2022
Beautiful Music Player app built using SwiftUI to demonstrate Neumorphic design pattern and MVVM architecture.

Beautiful Music Player app built using SwiftUI to demonstrate Neumorphic design pattern ?? and MVVM architecture ?? . Made with love ❤️ by Sameer Nawaz

Sameer Nawaz 120 Jan 4, 2023
Music Player for iOS which looks & feels like classic player

Prodigal Music Player APP looks and feels like a classic device. Bring back the good old player to life. Screenshots Home Page Album Gallery Home Page

bob.sun 40 Nov 11, 2022
A real-time, votable, democratized music queue on iPad and iPhone using Spotify

Queue'd Music Queue'd is the best way to enjoy music with your friends. Add your favorite songs to a shared music queue at your favorite bars, restaur

Ryan Daulton 88 Dec 2, 2022
MuVis is a macOS, iOS, iPadOS app for real-time music visualization.

MuVis MuVis is an open-source multiplatform app (using SwiftUI, Swift, and Xcode) for music visualization. It renders informative (and musically usefu

Keith Bromley 7 Oct 10, 2022
YiVideoEditor is a library for rotating, cropping, adding layers (watermark) and as well as adding audio (music) to the videos.

YiVideoEditor YiVideoEditor is a library for rotating, cropping, adding layers (watermark) and as well as adding audio (music) to the videos. YiVideoE

coderyi 97 Dec 14, 2022