diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..e5383d6 Binary files /dev/null and b/.DS_Store differ diff --git a/.gitignore b/.gitignore index cf92729..f398140 100644 --- a/.gitignore +++ b/.gitignore @@ -56,4 +56,4 @@ Carthage/Build # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md fastlane/report.xml -fastlane/screenshots \ No newline at end of file +fastlane/screenshots diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ESTMusicIndicator.podspec b/ESTMusicIndicator.podspec index 092fd9c..17630ba 100644 --- a/ESTMusicIndicator.podspec +++ b/ESTMusicIndicator.podspec @@ -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 @@ -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 diff --git a/Example/.DS_Store b/Example/.DS_Store new file mode 100644 index 0000000..883f23a Binary files /dev/null and b/Example/.DS_Store differ diff --git a/Example/ESTMusicIndicator.xcodeproj/project.pbxproj b/Example/ESTMusicIndicator.xcodeproj/project.pbxproj index 09c8f34..7e4d918 100644 --- a/Example/ESTMusicIndicator.xcodeproj/project.pbxproj +++ b/Example/ESTMusicIndicator.xcodeproj/project.pbxproj @@ -7,52 +7,31 @@ objects = { /* Begin PBXBuildFile section */ - 564E7FEC1C14624500353CC0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564E7FEB1C14624500353CC0 /* AppDelegate.swift */; }; - 564E7FF31C14624500353CC0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 564E7FF21C14624500353CC0 /* Assets.xcassets */; }; + 306522F8257E3B1C0047047F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 306522F4257E3B1C0047047F /* Assets.xcassets */; }; + 306522F9257E3B1C0047047F /* Base.lproj in Resources */ = {isa = PBXBuildFile; fileRef = 306522F5257E3B1C0047047F /* Base.lproj */; }; + 306522FA257E3B1C0047047F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 306522F6257E3B1C0047047F /* AppDelegate.swift */; }; + 30652332257E3DBA0047047F /* ESTMusicIndicatorContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3065232F257E3DBA0047047F /* ESTMusicIndicatorContentView.swift */; }; + 30652333257E3DBA0047047F /* ESTMusicIndicatorViewState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30652330257E3DBA0047047F /* ESTMusicIndicatorViewState.swift */; }; + 30652334257E3DBA0047047F /* ESTMusicIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30652331257E3DBA0047047F /* ESTMusicIndicatorView.swift */; }; 564E7FF61C14624500353CC0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 564E7FF41C14624500353CC0 /* LaunchScreen.storyboard */; }; - 564E80011C14624500353CC0 /* ESTMusicIndicatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564E80001C14624500353CC0 /* ESTMusicIndicatorTests.swift */; }; - 564E800C1C14624500353CC0 /* ESTMusicIndicatorUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564E800B1C14624500353CC0 /* ESTMusicIndicatorUITests.swift */; }; 567B8C651C31900A001EE48A /* MusicList.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 567B8C641C31900A001EE48A /* MusicList.storyboard */; }; 567B8C671C3190A4001EE48A /* MusicListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567B8C661C3190A4001EE48A /* MusicListViewController.swift */; }; 567B8C691C3191FD001EE48A /* MusicListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567B8C681C3191FD001EE48A /* MusicListCell.swift */; }; - 56C1B9091C36963400990D01 /* ESTMusicIndicatorContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56C1B9071C36963400990D01 /* ESTMusicIndicatorContentView.swift */; }; - 56C1B90A1C36963400990D01 /* ESTMusicIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56C1B9081C36963400990D01 /* ESTMusicIndicatorView.swift */; }; /* End PBXBuildFile section */ -/* Begin PBXContainerItemProxy section */ - 564E7FFD1C14624500353CC0 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 564E7FE01C14624500353CC0 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 564E7FE71C14624500353CC0; - remoteInfo = ESTMusicIndicator; - }; - 564E80081C14624500353CC0 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 564E7FE01C14624500353CC0 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 564E7FE71C14624500353CC0; - remoteInfo = ESTMusicIndicator; - }; -/* End PBXContainerItemProxy section */ - /* Begin PBXFileReference section */ + 306522F4257E3B1C0047047F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 306522F5257E3B1C0047047F /* Base.lproj */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Base.lproj; sourceTree = ""; }; + 306522F6257E3B1C0047047F /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 306522F7257E3B1C0047047F /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 3065232F257E3DBA0047047F /* ESTMusicIndicatorContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ESTMusicIndicatorContentView.swift; path = ../../Sources/ESTMusicIndicator/ESTMusicIndicatorContentView.swift; sourceTree = ""; }; + 30652330257E3DBA0047047F /* ESTMusicIndicatorViewState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ESTMusicIndicatorViewState.swift; path = ../../Sources/ESTMusicIndicator/ESTMusicIndicatorViewState.swift; sourceTree = ""; }; + 30652331257E3DBA0047047F /* ESTMusicIndicatorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ESTMusicIndicatorView.swift; path = ../../Sources/ESTMusicIndicator/ESTMusicIndicatorView.swift; sourceTree = ""; }; 564E7FE81C14624500353CC0 /* ESTMusicIndicator.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ESTMusicIndicator.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 564E7FEB1C14624500353CC0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = ../AppDelegate.swift; sourceTree = ""; }; - 564E7FF21C14624500353CC0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = ../Assets.xcassets; sourceTree = ""; }; 564E7FF51C14624500353CC0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 564E7FF71C14624500353CC0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = ../Info.plist; sourceTree = ""; }; - 564E7FFC1C14624500353CC0 /* ESTMusicIndicatorTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ESTMusicIndicatorTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 564E80001C14624500353CC0 /* ESTMusicIndicatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ESTMusicIndicatorTests.swift; sourceTree = ""; }; - 564E80021C14624500353CC0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 564E80071C14624500353CC0 /* ESTMusicIndicatorUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ESTMusicIndicatorUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 564E800B1C14624500353CC0 /* ESTMusicIndicatorUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ESTMusicIndicatorUITests.swift; sourceTree = ""; }; - 564E800D1C14624500353CC0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 567B8C641C31900A001EE48A /* MusicList.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = MusicList.storyboard; sourceTree = ""; }; 567B8C661C3190A4001EE48A /* MusicListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MusicListViewController.swift; sourceTree = ""; }; 567B8C681C3191FD001EE48A /* MusicListCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MusicListCell.swift; sourceTree = ""; }; - 56C1B9071C36963400990D01 /* ESTMusicIndicatorContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ESTMusicIndicatorContentView.swift; sourceTree = ""; }; - 56C1B9081C36963400990D01 /* ESTMusicIndicatorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ESTMusicIndicatorView.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -63,29 +42,23 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 564E7FF91C14624500353CC0 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 564E80041C14624500353CC0 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 3065232E257E3DA70047047F /* Sources */ = { + isa = PBXGroup; + children = ( + 3065232F257E3DBA0047047F /* ESTMusicIndicatorContentView.swift */, + 30652331257E3DBA0047047F /* ESTMusicIndicatorView.swift */, + 30652330257E3DBA0047047F /* ESTMusicIndicatorViewState.swift */, + ); + name = Sources; + sourceTree = ""; + }; 564E7FDF1C14624500353CC0 = { isa = PBXGroup; children = ( 564E7FEA1C14624500353CC0 /* ESTMusicIndicator */, - 564E7FFF1C14624500353CC0 /* ESTMusicIndicatorTests */, - 564E800A1C14624500353CC0 /* ESTMusicIndicatorUITests */, 564E7FE91C14624500353CC0 /* Products */, D53CCC9AFDA63197E363E189 /* Frameworks */, ); @@ -95,8 +68,6 @@ isa = PBXGroup; children = ( 564E7FE81C14624500353CC0 /* ESTMusicIndicator.app */, - 564E7FFC1C14624500353CC0 /* ESTMusicIndicatorTests.xctest */, - 564E80071C14624500353CC0 /* ESTMusicIndicatorUITests.xctest */, ); name = Products; sourceTree = ""; @@ -104,33 +75,17 @@ 564E7FEA1C14624500353CC0 /* ESTMusicIndicator */ = { isa = PBXGroup; children = ( - 56C1B9061C36963400990D01 /* Classes */, + 3065232E257E3DA70047047F /* Sources */, + 306522F6257E3B1C0047047F /* AppDelegate.swift */, + 306522F4257E3B1C0047047F /* Assets.xcassets */, + 306522F5257E3B1C0047047F /* Base.lproj */, + 306522F7257E3B1C0047047F /* Info.plist */, 564E801A1C14627800353CC0 /* Controllers */, - 564E801B1C14627800353CC0 /* Resources */, - 564E801C1C14627800353CC0 /* Supporting Files */, 564E801D1C14627800353CC0 /* Views */, ); path = ESTMusicIndicator; sourceTree = ""; }; - 564E7FFF1C14624500353CC0 /* ESTMusicIndicatorTests */ = { - isa = PBXGroup; - children = ( - 564E80001C14624500353CC0 /* ESTMusicIndicatorTests.swift */, - 564E80021C14624500353CC0 /* Info.plist */, - ); - path = ESTMusicIndicatorTests; - sourceTree = ""; - }; - 564E800A1C14624500353CC0 /* ESTMusicIndicatorUITests */ = { - isa = PBXGroup; - children = ( - 564E800B1C14624500353CC0 /* ESTMusicIndicatorUITests.swift */, - 564E800D1C14624500353CC0 /* Info.plist */, - ); - path = ESTMusicIndicatorUITests; - sourceTree = ""; - }; 564E801A1C14627800353CC0 /* Controllers */ = { isa = PBXGroup; children = ( @@ -139,23 +94,6 @@ path = Controllers; sourceTree = ""; }; - 564E801B1C14627800353CC0 /* Resources */ = { - isa = PBXGroup; - children = ( - 564E7FF21C14624500353CC0 /* Assets.xcassets */, - ); - path = Resources; - sourceTree = ""; - }; - 564E801C1C14627800353CC0 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 564E7FEB1C14624500353CC0 /* AppDelegate.swift */, - 564E7FF71C14624500353CC0 /* Info.plist */, - ); - path = "Supporting Files"; - sourceTree = ""; - }; 564E801D1C14627800353CC0 /* Views */ = { isa = PBXGroup; children = ( @@ -166,16 +104,6 @@ path = Views; sourceTree = ""; }; - 56C1B9061C36963400990D01 /* Classes */ = { - isa = PBXGroup; - children = ( - 56C1B9071C36963400990D01 /* ESTMusicIndicatorContentView.swift */, - 56C1B9081C36963400990D01 /* ESTMusicIndicatorView.swift */, - ); - name = Classes; - path = ../../Classes; - sourceTree = ""; - }; D53CCC9AFDA63197E363E189 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -203,42 +131,6 @@ productReference = 564E7FE81C14624500353CC0 /* ESTMusicIndicator.app */; productType = "com.apple.product-type.application"; }; - 564E7FFB1C14624500353CC0 /* ESTMusicIndicatorTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 564E80131C14624500353CC0 /* Build configuration list for PBXNativeTarget "ESTMusicIndicatorTests" */; - buildPhases = ( - 564E7FF81C14624500353CC0 /* Sources */, - 564E7FF91C14624500353CC0 /* Frameworks */, - 564E7FFA1C14624500353CC0 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 564E7FFE1C14624500353CC0 /* PBXTargetDependency */, - ); - name = ESTMusicIndicatorTests; - productName = ESTMusicIndicatorTests; - productReference = 564E7FFC1C14624500353CC0 /* ESTMusicIndicatorTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 564E80061C14624500353CC0 /* ESTMusicIndicatorUITests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 564E80161C14624500353CC0 /* Build configuration list for PBXNativeTarget "ESTMusicIndicatorUITests" */; - buildPhases = ( - 564E80031C14624500353CC0 /* Sources */, - 564E80041C14624500353CC0 /* Frameworks */, - 564E80051C14624500353CC0 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 564E80091C14624500353CC0 /* PBXTargetDependency */, - ); - name = ESTMusicIndicatorUITests; - productName = ESTMusicIndicatorUITests; - productReference = 564E80071C14624500353CC0 /* ESTMusicIndicatorUITests.xctest */; - productType = "com.apple.product-type.bundle.ui-testing"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -251,17 +143,7 @@ TargetAttributes = { 564E7FE71C14624500353CC0 = { CreatedOnToolsVersion = 7.1.1; - LastSwiftMigration = 0940; - }; - 564E7FFB1C14624500353CC0 = { - CreatedOnToolsVersion = 7.1.1; - LastSwiftMigration = 0900; - TestTargetID = 564E7FE71C14624500353CC0; - }; - 564E80061C14624500353CC0 = { - CreatedOnToolsVersion = 7.1.1; - LastSwiftMigration = 0900; - TestTargetID = 564E7FE71C14624500353CC0; + LastSwiftMigration = 1220; }; }; }; @@ -270,6 +152,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -279,8 +162,6 @@ projectRoot = ""; targets = ( 564E7FE71C14624500353CC0 /* ESTMusicIndicator */, - 564E7FFB1C14624500353CC0 /* ESTMusicIndicatorTests */, - 564E80061C14624500353CC0 /* ESTMusicIndicatorUITests */, ); }; /* End PBXProject section */ @@ -291,22 +172,9 @@ buildActionMask = 2147483647; files = ( 567B8C651C31900A001EE48A /* MusicList.storyboard in Resources */, + 306522F8257E3B1C0047047F /* Assets.xcassets in Resources */, + 306522F9257E3B1C0047047F /* Base.lproj in Resources */, 564E7FF61C14624500353CC0 /* LaunchScreen.storyboard in Resources */, - 564E7FF31C14624500353CC0 /* Assets.xcassets in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 564E7FFA1C14624500353CC0 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 564E80051C14624500353CC0 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( ); runOnlyForDeploymentPostprocessing = 0; }; @@ -317,45 +185,17 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 306522FA257E3B1C0047047F /* AppDelegate.swift in Sources */, + 30652334257E3DBA0047047F /* ESTMusicIndicatorView.swift in Sources */, + 30652333257E3DBA0047047F /* ESTMusicIndicatorViewState.swift in Sources */, + 30652332257E3DBA0047047F /* ESTMusicIndicatorContentView.swift in Sources */, 567B8C671C3190A4001EE48A /* MusicListViewController.swift in Sources */, - 56C1B90A1C36963400990D01 /* ESTMusicIndicatorView.swift in Sources */, - 56C1B9091C36963400990D01 /* ESTMusicIndicatorContentView.swift in Sources */, 567B8C691C3191FD001EE48A /* MusicListCell.swift in Sources */, - 564E7FEC1C14624500353CC0 /* AppDelegate.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 564E7FF81C14624500353CC0 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 564E80011C14624500353CC0 /* ESTMusicIndicatorTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 564E80031C14624500353CC0 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 564E800C1C14624500353CC0 /* ESTMusicIndicatorUITests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ -/* Begin PBXTargetDependency section */ - 564E7FFE1C14624500353CC0 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 564E7FE71C14624500353CC0 /* ESTMusicIndicator */; - targetProxy = 564E7FFD1C14624500353CC0 /* PBXContainerItemProxy */; - }; - 564E80091C14624500353CC0 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 564E7FE71C14624500353CC0 /* ESTMusicIndicator */; - targetProxy = 564E80081C14624500353CC0 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - /* Begin PBXVariantGroup section */ 564E7FF41C14624500353CC0 /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; @@ -476,12 +316,12 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = ESTMusicIndicator/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.est-group.ESTMusicIndicator"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -490,68 +330,12 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = ESTMusicIndicator/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.est-group.ESTMusicIndicator"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; - }; - name = Release; - }; - 564E80141C14624500353CC0 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - INFOPLIST_FILE = ESTMusicIndicatorTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "org.est-group.ESTMusicIndicatorTests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ESTMusicIndicator.app/ESTMusicIndicator"; - }; - name = Debug; - }; - 564E80151C14624500353CC0 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - INFOPLIST_FILE = ESTMusicIndicatorTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "org.est-group.ESTMusicIndicatorTests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ESTMusicIndicator.app/ESTMusicIndicator"; - }; - name = Release; - }; - 564E80171C14624500353CC0 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - INFOPLIST_FILE = ESTMusicIndicatorUITests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "org.est-group.ESTMusicIndicatorUITests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; - TEST_TARGET_NAME = ESTMusicIndicator; - USES_XCTRUNNER = YES; - }; - name = Debug; - }; - 564E80181C14624500353CC0 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - INFOPLIST_FILE = ESTMusicIndicatorUITests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "org.est-group.ESTMusicIndicatorUITests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; - TEST_TARGET_NAME = ESTMusicIndicator; - USES_XCTRUNNER = YES; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -576,24 +360,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 564E80131C14624500353CC0 /* Build configuration list for PBXNativeTarget "ESTMusicIndicatorTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 564E80141C14624500353CC0 /* Debug */, - 564E80151C14624500353CC0 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 564E80161C14624500353CC0 /* Build configuration list for PBXNativeTarget "ESTMusicIndicatorUITests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 564E80171C14624500353CC0 /* Debug */, - 564E80181C14624500353CC0 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; /* End XCConfigurationList section */ }; rootObject = 564E7FE01C14624500353CC0 /* Project object */; diff --git a/Example/ESTMusicIndicator.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/ESTMusicIndicator.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Example/ESTMusicIndicator.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Example/ESTMusicIndicator/AppDelegate.swift b/Example/ESTMusicIndicator/AppDelegate.swift index 98a7950..b6bef7e 100644 --- a/Example/ESTMusicIndicator/AppDelegate.swift +++ b/Example/ESTMusicIndicator/AppDelegate.swift @@ -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 diff --git a/Example/ESTMusicIndicator/Base.lproj/LaunchScreen.storyboard b/Example/ESTMusicIndicator/Base.lproj/LaunchScreen.storyboard index 1042eb6..9c6a580 100644 --- a/Example/ESTMusicIndicator/Base.lproj/LaunchScreen.storyboard +++ b/Example/ESTMusicIndicator/Base.lproj/LaunchScreen.storyboard @@ -1,8 +1,10 @@ - - + + + - + + @@ -14,9 +16,9 @@ - + - + diff --git a/Example/ESTMusicIndicator/Package.swift b/Example/ESTMusicIndicator/Package.swift new file mode 100644 index 0000000..6776917 --- /dev/null +++ b/Example/ESTMusicIndicator/Package.swift @@ -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: []) + ] +) diff --git a/Example/ESTMusicIndicatorTests/ESTMusicIndicatorTests.swift b/Example/ESTMusicIndicatorTests/ESTMusicIndicatorTests.swift deleted file mode 100644 index 4889d2c..0000000 --- a/Example/ESTMusicIndicatorTests/ESTMusicIndicatorTests.swift +++ /dev/null @@ -1,36 +0,0 @@ -// -// ESTMusicIndicatorTests.swift -// ESTMusicIndicatorTests -// -// Created by Aufree on 12/6/15. -// Copyright © 2015 The EST Group. All rights reserved. -// - -import XCTest -@testable import ESTMusicIndicator - -class ESTMusicIndicatorTests: XCTestCase { - - override func setUp() { - super.setUp() - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDown() { - // Put teardown code here. This method is called after the invocation of each test method in the class. - super.tearDown() - } - - func testExample() { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct results. - } - - func testPerformanceExample() { - // This is an example of a performance test case. - self.measure { - // Put the code you want to measure the time of here. - } - } - -} diff --git a/Example/ESTMusicIndicatorTests/Info.plist b/Example/ESTMusicIndicatorTests/Info.plist deleted file mode 100644 index ba72822..0000000 --- a/Example/ESTMusicIndicatorTests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/Example/ESTMusicIndicatorUITests/ESTMusicIndicatorUITests.swift b/Example/ESTMusicIndicatorUITests/ESTMusicIndicatorUITests.swift deleted file mode 100644 index 92d41ee..0000000 --- a/Example/ESTMusicIndicatorUITests/ESTMusicIndicatorUITests.swift +++ /dev/null @@ -1,36 +0,0 @@ -// -// ESTMusicIndicatorUITests.swift -// ESTMusicIndicatorUITests -// -// Created by Aufree on 12/6/15. -// Copyright © 2015 The EST Group. All rights reserved. -// - -import XCTest - -class ESTMusicIndicatorUITests: XCTestCase { - - override func setUp() { - super.setUp() - - // Put setup code here. This method is called before the invocation of each test method in the class. - - // In UI tests it is usually best to stop immediately when a failure occurs. - continueAfterFailure = false - // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. - XCUIApplication().launch() - - // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. - } - - override func tearDown() { - // Put teardown code here. This method is called after the invocation of each test method in the class. - super.tearDown() - } - - func testExample() { - // Use recording to get started writing UI tests. - // Use XCTAssert and related functions to verify your tests produce the correct results. - } - -} diff --git a/Example/ESTMusicIndicatorUITests/Info.plist b/Example/ESTMusicIndicatorUITests/Info.plist deleted file mode 100644 index ba72822..0000000 --- a/Example/ESTMusicIndicatorUITests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..8dc5506 --- /dev/null +++ b/Package.swift @@ -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: []) + ] +) diff --git a/README.md b/README.md index acb1c49..d19ca01 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/Sources/.DS_Store b/Sources/.DS_Store new file mode 100644 index 0000000..f5ad0fe Binary files /dev/null and b/Sources/.DS_Store differ diff --git a/Classes/ESTMusicIndicatorContentView.swift b/Sources/ESTMusicIndicator/ESTMusicIndicatorContentView.swift similarity index 96% rename from Classes/ESTMusicIndicatorContentView.swift rename to Sources/ESTMusicIndicator/ESTMusicIndicatorContentView.swift index f90d3d1..2245cb5 100644 --- a/Classes/ESTMusicIndicatorContentView.swift +++ b/Sources/ESTMusicIndicator/ESTMusicIndicatorContentView.swift @@ -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) @@ -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) @@ -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) } @@ -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) } diff --git a/Classes/ESTMusicIndicatorView.swift b/Sources/ESTMusicIndicator/ESTMusicIndicatorView.swift similarity index 75% rename from Classes/ESTMusicIndicatorView.swift rename to Sources/ESTMusicIndicator/ESTMusicIndicatorView.swift index 00a5eb3..daf2b04 100644 --- a/Classes/ESTMusicIndicatorView.swift +++ b/Sources/ESTMusicIndicator/ESTMusicIndicatorView.swift @@ -25,34 +25,7 @@ import UIKit -/** - Values for the [state]([ESTMusicIndicatorView state]) property. - - - */ - -public enum ESTMusicIndicatorViewState: Int { - /** - Stopped state of an indicator view. - In this state, if an indicator's [hidesWhenStopped]([ESTMusicIndicatorView hidesWhenStopped]) is `YES`, the indicator becomes hidden. - Or if an indicator's [hidesWhenStopped]([ESTMusicIndicatorView hidesWhenStopped]) is `NO`, the indicator shows idle bars. - */ - case stopped - - /** - Playing state of an indicator view. - In this state, an indicator shows oscillatory animated bars. - */ - case playing - - /** - Paused state of an indicator view. - In this state, an indicator shows idle bars. - */ - case paused -} - -open class ESTMusicIndicatorView: UIView { +public class ESTMusicIndicatorView: UIView { /** A boolean value that controls whether the receiver is hidden @@ -88,7 +61,6 @@ open class ESTMusicIndicatorView: UIView { The initial value is `ESTMusicIndicatorViewStateStopped`. */ - public var state: ESTMusicIndicatorViewState = .stopped { didSet { if state == .stopped { @@ -107,8 +79,8 @@ open class ESTMusicIndicatorView: UIView { } } - private var hasInstalledConstraints: Bool = false - private var contentView:ESTMusicIndicatorContentView! + private var hasInstalledConstraints = false + private lazy var contentView = ESTMusicIndicatorContentView() override public init(frame: CGRect) { super.init(frame: frame) @@ -122,26 +94,26 @@ open class ESTMusicIndicatorView: UIView { private func commonInit() { layer.masksToBounds = true - contentView = ESTMusicIndicatorContentView.init() addSubview(contentView) prepareLayoutPriorities() setNeedsUpdateConstraints() - NotificationCenter.default.addObserver(self, selector: #selector(UIApplicationDelegate.applicationDidEnterBackground(_:)), name: NSNotification.Name.UIApplicationDidEnterBackground, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(UIApplicationDelegate.applicationWillEnterForeground(_:)), name: NSNotification.Name.UIApplicationWillEnterForeground, object: nil) + // Observe app's state + for name in [UIApplication.willEnterForegroundNotification, + UIApplication.didEnterBackgroundNotification] { + NotificationCenter.default.addObserver(forName: name, object: nil, queue: nil) { [weak self] notification in + self?.handleApplicationStateChanged(notification) + } + } } private func prepareLayoutPriorities() { // Custom views should set default values for both orientations on creation, // based on their content, typically to NSLayoutPriorityDefaultLow or NSLayoutPriorityDefaultHigh. - setContentHuggingPriority(UILayoutPriority.defaultHigh, for: UILayoutConstraintAxis.horizontal) - setContentHuggingPriority(UILayoutPriority.defaultHigh, for: UILayoutConstraintAxis.vertical) + setContentHuggingPriority(UILayoutPriority.defaultHigh, for: NSLayoutConstraint.Axis.horizontal) + setContentHuggingPriority(UILayoutPriority.defaultHigh, for: NSLayoutConstraint.Axis.vertical) - setContentCompressionResistancePriority(UILayoutPriority.defaultHigh, for: UILayoutConstraintAxis.horizontal) - setContentCompressionResistancePriority(UILayoutPriority.defaultHigh, for: UILayoutConstraintAxis.vertical) - } - - deinit { - NotificationCenter.default.removeObserver(self) + setContentCompressionResistancePriority(UILayoutPriority.defaultHigh, for: NSLayoutConstraint.Axis.horizontal) + setContentCompressionResistancePriority(UILayoutPriority.defaultHigh, for: NSLayoutConstraint.Axis.vertical) } // MARK: Auto Layout @@ -173,7 +145,7 @@ open class ESTMusicIndicatorView: UIView { super.updateConstraints() } - override open func forBaselineLayout() -> UIView { + open override var forFirstBaselineLayout: UIView { return contentView } @@ -186,7 +158,6 @@ open class ESTMusicIndicatorView: UIView { // MARK: Helpers private func startAnimating() { - if contentView.isOscillating() { return } @@ -205,16 +176,17 @@ open class ESTMusicIndicatorView: UIView { } // MARK: Notification - - @objc - private func applicationDidEnterBackground(_ notification: Notification) { - stopAnimating() - } - - @objc - private func applicationWillEnterForeground(_ notification: Notification) { - if state == .playing { - startAnimating() - } - } + private func handleApplicationStateChanged(_ sender: Notification) { + switch sender.name { + case UIApplication.willEnterForegroundNotification: + guard state == .playing else { + break + } + startAnimating() + case UIApplication.didEnterBackgroundNotification: + stopAnimating() + default: + break + } + } } diff --git a/Sources/ESTMusicIndicator/ESTMusicIndicatorViewState.swift b/Sources/ESTMusicIndicator/ESTMusicIndicatorViewState.swift new file mode 100644 index 0000000..edadac4 --- /dev/null +++ b/Sources/ESTMusicIndicator/ESTMusicIndicatorViewState.swift @@ -0,0 +1,50 @@ +// +// ESTMusicIndicatorView.swift +// ESTMusicIndicator +// +// Created by Aufree on 12/6/15. +// Copyright © 2015 The EST Group. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +import Foundation + +/** + Values for the [state]([ESTMusicIndicatorView state]) property. + */ +public enum ESTMusicIndicatorViewState: Int { + /** + Stopped state of an indicator view. + In this state, if an indicator's [hidesWhenStopped]([ESTMusicIndicatorView hidesWhenStopped]) is `YES`, the indicator becomes hidden. + Or if an indicator's [hidesWhenStopped]([ESTMusicIndicatorView hidesWhenStopped]) is `NO`, the indicator shows idle bars. + */ + case stopped + + /** + Playing state of an indicator view. + In this state, an indicator shows oscillatory animated bars. + */ + case playing + + /** + Paused state of an indicator view. + In this state, an indicator shows idle bars. + */ + case paused +}