Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ Carthage/Build
# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md

fastlane/report.xml
fastlane/screenshots
fastlane/screenshots
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions ESTMusicIndicator.podspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Pod::Spec.new do |s|

s.name = "ESTMusicIndicator"
s.version = "0.2.0"
s.swift_version = "4.0"
s.version = "0.3.0"
s.swift_version = "5.0"
s.summary = "Cool Animated music indicator view written in Swift."

s.description = <<-DESC
Expand All @@ -16,10 +16,10 @@ Pod::Spec.new do |s|
s.license = "MIT"
s.author = { "Aufree" => "freedomlijinfa@gmail.com" }

s.platform = :ios, "8.0"
s.platform = :ios, "10.0"

s.source = { :git => "https://github.com/Aufree/ESTMusicIndicator.git", :tag => s.version }

s.source_files = "Classes/**/*.swift"
s.source_files = "Sources/ESTMusicIndicator/**/*.swift"
s.frameworks = 'QuartzCore'
end
Binary file added Example/.DS_Store
Binary file not shown.
314 changes: 40 additions & 274 deletions Example/ESTMusicIndicator.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
1 change: 0 additions & 1 deletion Example/ESTMusicIndicator/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


private func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
return true
Expand Down
12 changes: 7 additions & 5 deletions Example/ESTMusicIndicator/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="14F1509" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17506" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17505"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
Expand All @@ -14,9 +16,9 @@
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
Expand Down
28 changes: 28 additions & 0 deletions Example/ESTMusicIndicator/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "ESTMusicIndicator",
platforms: [
.iOS(.v10)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "ESTMusicIndicator",
targets: ["ESTMusicIndicator"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "ESTMusicIndicator",
dependencies: [])
]
)
36 changes: 0 additions & 36 deletions Example/ESTMusicIndicatorTests/ESTMusicIndicatorTests.swift

This file was deleted.

24 changes: 0 additions & 24 deletions Example/ESTMusicIndicatorTests/Info.plist

This file was deleted.

36 changes: 0 additions & 36 deletions Example/ESTMusicIndicatorUITests/ESTMusicIndicatorUITests.swift

This file was deleted.

24 changes: 0 additions & 24 deletions Example/ESTMusicIndicatorUITests/Info.plist

This file was deleted.

28 changes: 28 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "ESTMusicIndicator",
platforms: [
.iOS(.v10)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "ESTMusicIndicator",
targets: ["ESTMusicIndicator"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "ESTMusicIndicator",
dependencies: [])
]
)
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ $ open Example/ESTMusicIndicator.xcodeproj

## Installation

### Swift Package Manager
SPM is a dependency manager built into Xcode.

ESTMusicIndicator can be installed via Swift Package Manager. To use it in your project, open Xcode, go to menu File -> Swift Packages -> Add Package Dependency, and paste this repo's URL:
`https://github.com/Aufree/ESTMusicIndicator.git`

### CocoaPods

CocoaPods is a dependency manager for Cocoa projects.
Expand Down
Binary file added Sources/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,27 @@ class ESTMusicIndicatorContentView: UIView {

override init(frame: CGRect) {
super.init(frame: frame)
translatesAutoresizingMaskIntoConstraints = false
prepareBarLayers()
tintColorDidChange()
setNeedsUpdateConstraints()
commonInit()
}

convenience init() {
self.init(frame:CGRect.zero)
self.init(frame: CGRect.zero)
}

required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
commonInit()
}

private func commonInit() {
translatesAutoresizingMaskIntoConstraints = false
prepareBarLayers()
tintColorDidChange()
setNeedsUpdateConstraints()
}

private func prepareBarLayers() {
var xOffset:CGFloat = 0.0
var xOffset: CGFloat = 0.0

for i in 1...kBarCount {
let newLayer = createBarLayerWithXOffset(xOffset, layerIndex: i)
Expand Down Expand Up @@ -93,7 +98,7 @@ class ESTMusicIndicatorContentView: UIView {
}

override var intrinsicContentSize : CGSize {
var unionFrame:CGRect = CGRect.zero
var unionFrame = CGRect.zero

for layer in barLayers {
unionFrame = unionFrame.union(layer.frame)
Expand Down Expand Up @@ -175,7 +180,7 @@ class ESTMusicIndicatorContentView: UIView {
animation.repeatCount = Float.infinity // Forever
animation.autoreverses = true
animation.duration = TimeInterval((CGFloat(basePeriod) / 2) * (kBarMaxPeakHeight / peakHeight))
animation.timingFunction = CAMediaTimingFunction.init(name: kCAMediaTimingFunctionEaseIn)
animation.timingFunction = CAMediaTimingFunction.init(name: CAMediaTimingFunctionName.easeIn)

layer.add(animation, forKey: kOscillationAnimationKey)
}
Expand All @@ -188,7 +193,7 @@ class ESTMusicIndicatorContentView: UIView {
}
animation.toValue = NSValue(cgRect:layer.bounds)
animation.duration = kDecayDuration
animation.timingFunction = CAMediaTimingFunction.init(name: kCAMediaTimingFunctionEaseOut)
animation.timingFunction = CAMediaTimingFunction.init(name: CAMediaTimingFunctionName.easeOut)

layer.add(animation, forKey: kDecayAnimationKey)
}
Expand Down
Loading