diff --git a/.gitignore b/.gitignore index 8615121..941528f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,12 @@ # Xcode # +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## Build generated build/ +DerivedData/ + +## Various settings *.pbxuser !default.pbxuser *.mode1v3 @@ -9,19 +15,40 @@ build/ !default.mode2v3 *.perspectivev3 !default.perspectivev3 -xcuserdata -*.xccheckout +xcuserdata/ + +## Other *.moved-aside -DerivedData +*.xccheckout +*.xcscmblueprint + +## Obj-C/Swift specific *.hmap *.ipa -*.xcuserstate +*.dSYM.zip +*.dSYM + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +# Package.pins +# Package.resolved +.build/ + +*.DS_Store +.idea/ +.vscode/ # CocoaPods # # We recommend against adding the Pods directory to your .gitignore. However # you should judge for yourself, the pros and cons are mentioned at: -# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control # # Pods/ @@ -31,3 +58,15 @@ DerivedData # Carthage/Checkouts Carthage/Build + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/#source-control + +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots/**/*.png +fastlane/test_output diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index f7ba619..0000000 --- a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/DOFavoriteButton.podspec b/DOFavoriteButton.podspec deleted file mode 100644 index c594f26..0000000 --- a/DOFavoriteButton.podspec +++ /dev/null @@ -1,16 +0,0 @@ -Pod::Spec.new do |s| - s.name = "DOFavoriteButton" - s.version = "0.0.4" - s.summary = "Cute Animated Button written in Swift. It could be just right for favorite buttons!" - s.homepage = "https://github.com/okmr-d/DOFavoriteButton" - s.screenshots = "https://raw.githubusercontent.com/okmr-d/okmr-d.github.io/master/img/DOFavoriteButton/demo.gif" - s.license = { :type => "MIT", :file => "LICENSE" } - s.author = { "Daiki Okumura" => "daiki.okumura@gmail.com" } - s.social_media_url = "http://twitter.com/okmr_d" - s.platform = :ios, "8.0" - s.source = { :git => "https://github.com/okmr-d/DOFavoriteButton.git", :tag => s.version.to_s } - s.source_files = "DOFavoriteButton/*.swift" - s.resources = "DOFavoriteButton/*.png" - s.framework = "UIKit" - s.requires_arc = true -end diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO.xcodeproj/project.pbxproj b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO.xcodeproj/project.pbxproj similarity index 81% rename from DOFavoriteButton-DEMO/DOFavoriteButton-DEMO.xcodeproj/project.pbxproj rename to DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO.xcodeproj/project.pbxproj index 78be48a..8b0d705 100644 --- a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO.xcodeproj/project.pbxproj +++ b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO.xcodeproj/project.pbxproj @@ -7,15 +7,15 @@ objects = { /* Begin PBXBuildFile section */ - 4F6071201B6366ED0058F570 /* DOFavoriteButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F60711F1B6366ED0058F570 /* DOFavoriteButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4F60713C1B6367B00058F570 /* DOFavoriteButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F60713B1B6367B00058F570 /* DOFavoriteButton.swift */; }; + 0482A6B0230C1C5B00E84985 /* DOFavoriteButtonNew.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0482A6AF230C1C5B00E84985 /* DOFavoriteButtonNew.swift */; }; + 4F6071201B6366ED0058F570 /* DOFavoriteButtonNew.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F60711F1B6366ED0058F570 /* DOFavoriteButtonNew.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4FBAA7031B4D807F00C8657F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FBAA7021B4D807F00C8657F /* AppDelegate.swift */; }; 4FBAA7051B4D807F00C8657F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FBAA7041B4D807F00C8657F /* ViewController.swift */; }; 4FBAA7081B4D807F00C8657F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4FBAA7061B4D807F00C8657F /* Main.storyboard */; }; 4FBAA70A1B4D807F00C8657F /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4FBAA7091B4D807F00C8657F /* Images.xcassets */; }; 4FBAA70D1B4D807F00C8657F /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4FBAA70B1B4D807F00C8657F /* LaunchScreen.xib */; }; - 74018BBB1D86F8CB00B1EC84 /* DOFavoriteButton.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F60711B1B6366ED0058F570 /* DOFavoriteButton.framework */; }; - 74018BBC1D86F8CB00B1EC84 /* DOFavoriteButton.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4F60711B1B6366ED0058F570 /* DOFavoriteButton.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 74018BBB1D86F8CB00B1EC84 /* DOFavoriteButtonNew.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F60711B1B6366ED0058F570 /* DOFavoriteButtonNew.framework */; }; + 74018BBC1D86F8CB00B1EC84 /* DOFavoriteButtonNew.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4F60711B1B6366ED0058F570 /* DOFavoriteButtonNew.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; /* End PBXBuildFile section */ /* Begin PBXBuildRule section */ @@ -47,7 +47,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 74018BBC1D86F8CB00B1EC84 /* DOFavoriteButton.framework in Embed Frameworks */, + 74018BBC1D86F8CB00B1EC84 /* DOFavoriteButtonNew.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -55,11 +55,11 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 4F60711B1B6366ED0058F570 /* DOFavoriteButton.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DOFavoriteButton.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 0482A6AF230C1C5B00E84985 /* DOFavoriteButtonNew.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DOFavoriteButtonNew.swift; path = ../../DOFavoriteButtonNew/DOFavoriteButtonNew.swift; sourceTree = ""; }; + 4F60711B1B6366ED0058F570 /* DOFavoriteButtonNew.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DOFavoriteButtonNew.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 4F60711E1B6366ED0058F570 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 4F60711F1B6366ED0058F570 /* DOFavoriteButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DOFavoriteButton.h; sourceTree = ""; }; - 4F60713B1B6367B00058F570 /* DOFavoriteButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DOFavoriteButton.swift; path = ../../DOFavoriteButton/DOFavoriteButton.swift; sourceTree = ""; }; - 4FBAA6FD1B4D807F00C8657F /* DOFavoriteButton-DEMO.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DOFavoriteButton-DEMO.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 4F60711F1B6366ED0058F570 /* DOFavoriteButtonNew.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DOFavoriteButtonNew.h; sourceTree = ""; }; + 4FBAA6FD1B4D807F00C8657F /* DOFavoriteButtonNew-DEMO.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DOFavoriteButtonNew-DEMO.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 4FBAA7011B4D807F00C8657F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 4FBAA7021B4D807F00C8657F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 4FBAA7041B4D807F00C8657F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; @@ -80,21 +80,21 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 74018BBB1D86F8CB00B1EC84 /* DOFavoriteButton.framework in Frameworks */, + 74018BBB1D86F8CB00B1EC84 /* DOFavoriteButtonNew.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 4F60711C1B6366ED0058F570 /* DOFavoriteButton */ = { + 4F60711C1B6366ED0058F570 /* DOFavoriteButtonNew */ = { isa = PBXGroup; children = ( - 4F60713B1B6367B00058F570 /* DOFavoriteButton.swift */, - 4F60711F1B6366ED0058F570 /* DOFavoriteButton.h */, + 0482A6AF230C1C5B00E84985 /* DOFavoriteButtonNew.swift */, + 4F60711F1B6366ED0058F570 /* DOFavoriteButtonNew.h */, 4F60711D1B6366ED0058F570 /* Supporting Files */, ); - path = DOFavoriteButton; + path = DOFavoriteButtonNew; sourceTree = ""; }; 4F60711D1B6366ED0058F570 /* Supporting Files */ = { @@ -108,8 +108,8 @@ 4FBAA6F41B4D807F00C8657F = { isa = PBXGroup; children = ( - 4FBAA6FF1B4D807F00C8657F /* DOFavoriteButton-DEMO */, - 4F60711C1B6366ED0058F570 /* DOFavoriteButton */, + 4FBAA6FF1B4D807F00C8657F /* DOFavoriteButtonNew-DEMO */, + 4F60711C1B6366ED0058F570 /* DOFavoriteButtonNew */, 4FBAA6FE1B4D807F00C8657F /* Products */, ); sourceTree = ""; @@ -117,13 +117,13 @@ 4FBAA6FE1B4D807F00C8657F /* Products */ = { isa = PBXGroup; children = ( - 4FBAA6FD1B4D807F00C8657F /* DOFavoriteButton-DEMO.app */, - 4F60711B1B6366ED0058F570 /* DOFavoriteButton.framework */, + 4FBAA6FD1B4D807F00C8657F /* DOFavoriteButtonNew-DEMO.app */, + 4F60711B1B6366ED0058F570 /* DOFavoriteButtonNew.framework */, ); name = Products; sourceTree = ""; }; - 4FBAA6FF1B4D807F00C8657F /* DOFavoriteButton-DEMO */ = { + 4FBAA6FF1B4D807F00C8657F /* DOFavoriteButtonNew-DEMO */ = { isa = PBXGroup; children = ( 4FBAA7021B4D807F00C8657F /* AppDelegate.swift */, @@ -133,7 +133,7 @@ 4FBAA70B1B4D807F00C8657F /* LaunchScreen.xib */, 4FBAA7001B4D807F00C8657F /* Supporting Files */, ); - path = "DOFavoriteButton-DEMO"; + path = "DOFavoriteButtonNew-DEMO"; sourceTree = ""; }; 4FBAA7001B4D807F00C8657F /* Supporting Files */ = { @@ -151,16 +151,16 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 4F6071201B6366ED0058F570 /* DOFavoriteButton.h in Headers */, + 4F6071201B6366ED0058F570 /* DOFavoriteButtonNew.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 4F60711A1B6366ED0058F570 /* DOFavoriteButton */ = { + 4F60711A1B6366ED0058F570 /* DOFavoriteButtonNew */ = { isa = PBXNativeTarget; - buildConfigurationList = 4F6071341B6366ED0058F570 /* Build configuration list for PBXNativeTarget "DOFavoriteButton" */; + buildConfigurationList = 4F6071341B6366ED0058F570 /* Build configuration list for PBXNativeTarget "DOFavoriteButtonNew" */; buildPhases = ( 4F6071161B6366ED0058F570 /* Sources */, 4F6071171B6366ED0058F570 /* Frameworks */, @@ -172,14 +172,14 @@ ); dependencies = ( ); - name = DOFavoriteButton; + name = DOFavoriteButtonNew; productName = DOFavoriteButton; - productReference = 4F60711B1B6366ED0058F570 /* DOFavoriteButton.framework */; + productReference = 4F60711B1B6366ED0058F570 /* DOFavoriteButtonNew.framework */; productType = "com.apple.product-type.framework"; }; - 4FBAA6FC1B4D807F00C8657F /* DOFavoriteButton-DEMO */ = { + 4FBAA6FC1B4D807F00C8657F /* DOFavoriteButtonNew-DEMO */ = { isa = PBXNativeTarget; - buildConfigurationList = 4FBAA71C1B4D807F00C8657F /* Build configuration list for PBXNativeTarget "DOFavoriteButton-DEMO" */; + buildConfigurationList = 4FBAA71C1B4D807F00C8657F /* Build configuration list for PBXNativeTarget "DOFavoriteButtonNew-DEMO" */; buildPhases = ( 4FBAA6F91B4D807F00C8657F /* Sources */, 4FBAA6FA1B4D807F00C8657F /* Frameworks */, @@ -191,9 +191,9 @@ dependencies = ( 74018BBE1D86F8CB00B1EC84 /* PBXTargetDependency */, ); - name = "DOFavoriteButton-DEMO"; + name = "DOFavoriteButtonNew-DEMO"; productName = "DOFavoriteButton-DEMO"; - productReference = 4FBAA6FD1B4D807F00C8657F /* DOFavoriteButton-DEMO.app */; + productReference = 4FBAA6FD1B4D807F00C8657F /* DOFavoriteButtonNew-DEMO.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ @@ -209,18 +209,19 @@ TargetAttributes = { 4F60711A1B6366ED0058F570 = { CreatedOnToolsVersion = 6.4; - LastSwiftMigration = 0800; + LastSwiftMigration = 1030; }; 4FBAA6FC1B4D807F00C8657F = { CreatedOnToolsVersion = 6.4; }; }; }; - buildConfigurationList = 4FBAA6F81B4D807F00C8657F /* Build configuration list for PBXProject "DOFavoriteButton-DEMO" */; + buildConfigurationList = 4FBAA6F81B4D807F00C8657F /* Build configuration list for PBXProject "DOFavoriteButtonNew-DEMO" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -229,8 +230,8 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 4FBAA6FC1B4D807F00C8657F /* DOFavoriteButton-DEMO */, - 4F60711A1B6366ED0058F570 /* DOFavoriteButton */, + 4FBAA6FC1B4D807F00C8657F /* DOFavoriteButtonNew-DEMO */, + 4F60711A1B6366ED0058F570 /* DOFavoriteButtonNew */, ); }; /* End PBXProject section */ @@ -260,7 +261,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4F60713C1B6367B00058F570 /* DOFavoriteButton.swift in Sources */, + 0482A6B0230C1C5B00E84985 /* DOFavoriteButtonNew.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -278,7 +279,7 @@ /* Begin PBXTargetDependency section */ 74018BBE1D86F8CB00B1EC84 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 4F60711A1B6366ED0058F570 /* DOFavoriteButton */; + target = 4F60711A1B6366ED0058F570 /* DOFavoriteButtonNew */; targetProxy = 74018BBD1D86F8CB00B1EC84 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ @@ -317,7 +318,7 @@ "DEBUG=1", "$(inherited)", ); - INFOPLIST_FILE = DOFavoriteButton/Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/DOFavoriteButtonNew/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -325,7 +326,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -341,14 +342,14 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = DOFavoriteButton/Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/DOFavoriteButtonNew/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "co.devlog.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -448,12 +449,12 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = "DOFavoriteButton-DEMO/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/DOFavoriteButtonNew-DEMO/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "co.devlog.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -462,19 +463,19 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = "DOFavoriteButton-DEMO/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/DOFavoriteButtonNew-DEMO/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "co.devlog.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 4F6071341B6366ED0058F570 /* Build configuration list for PBXNativeTarget "DOFavoriteButton" */ = { + 4F6071341B6366ED0058F570 /* Build configuration list for PBXNativeTarget "DOFavoriteButtonNew" */ = { isa = XCConfigurationList; buildConfigurations = ( 4F6071351B6366ED0058F570 /* Debug */, @@ -483,7 +484,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 4FBAA6F81B4D807F00C8657F /* Build configuration list for PBXProject "DOFavoriteButton-DEMO" */ = { + 4FBAA6F81B4D807F00C8657F /* Build configuration list for PBXProject "DOFavoriteButtonNew-DEMO" */ = { isa = XCConfigurationList; buildConfigurations = ( 4FBAA71A1B4D807F00C8657F /* Debug */, @@ -492,7 +493,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 4FBAA71C1B4D807F00C8657F /* Build configuration list for PBXNativeTarget "DOFavoriteButton-DEMO" */ = { + 4FBAA71C1B4D807F00C8657F /* Build configuration list for PBXNativeTarget "DOFavoriteButtonNew-DEMO" */ = { isa = XCConfigurationList; buildConfigurations = ( 4FBAA71D1B4D807F00C8657F /* Debug */, diff --git a/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..4286d9f --- /dev/null +++ b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO.xcodeproj/xcshareddata/xcschemes/DOFavoriteButtonNew-DEMO.xcscheme b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO.xcodeproj/xcshareddata/xcschemes/DOFavoriteButtonNew-DEMO.xcscheme new file mode 100644 index 0000000..4ad32d4 --- /dev/null +++ b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO.xcodeproj/xcshareddata/xcschemes/DOFavoriteButtonNew-DEMO.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO.xcodeproj/xcshareddata/xcschemes/DOFavoriteButton.xcscheme b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO.xcodeproj/xcshareddata/xcschemes/DOFavoriteButtonNew.xcscheme similarity index 82% rename from DOFavoriteButton-DEMO/DOFavoriteButton-DEMO.xcodeproj/xcshareddata/xcschemes/DOFavoriteButton.xcscheme rename to DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO.xcodeproj/xcshareddata/xcschemes/DOFavoriteButtonNew.xcscheme index f5b5fb5..3f799f3 100644 --- a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO.xcodeproj/xcshareddata/xcschemes/DOFavoriteButton.xcscheme +++ b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO.xcodeproj/xcshareddata/xcschemes/DOFavoriteButtonNew.xcscheme @@ -1,6 +1,6 @@ + BuildableName = "DOFavoriteButtonNew.framework" + BlueprintName = "DOFavoriteButtonNew" + ReferencedContainer = "container:DOFavoriteButtonNew-DEMO.xcodeproj"> @@ -46,9 +46,9 @@ + BuildableName = "DOFavoriteButtonNew.framework" + BlueprintName = "DOFavoriteButtonNew" + ReferencedContainer = "container:DOFavoriteButtonNew-DEMO.xcodeproj"> @@ -64,9 +64,9 @@ + BuildableName = "DOFavoriteButtonNew.framework" + BlueprintName = "DOFavoriteButtonNew" + ReferencedContainer = "container:DOFavoriteButtonNew-DEMO.xcodeproj"> diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/AppDelegate.swift b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/AppDelegate.swift similarity index 92% rename from DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/AppDelegate.swift rename to DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/AppDelegate.swift index 3b5e0f9..90894d6 100644 --- a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/AppDelegate.swift +++ b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/AppDelegate.swift @@ -14,8 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool { - // Override point for customization after application launch. + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { return true } diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Base.lproj/LaunchScreen.xib b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Base.lproj/LaunchScreen.xib similarity index 78% rename from DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Base.lproj/LaunchScreen.xib rename to DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Base.lproj/LaunchScreen.xib index cbcb182..04a873a 100644 --- a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Base.lproj/LaunchScreen.xib +++ b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Base.lproj/LaunchScreen.xib @@ -1,9 +1,8 @@ - - + + - - - + + @@ -14,21 +13,18 @@ - - - + diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Base.lproj/Main.storyboard b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Base.lproj/Main.storyboard similarity index 76% rename from DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Base.lproj/Main.storyboard rename to DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Base.lproj/Main.storyboard index 280b163..e7092ce 100644 --- a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Base.lproj/Main.storyboard +++ b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Base.lproj/Main.storyboard @@ -1,55 +1,56 @@ - - + + + + + - + + - + - + - - - + diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/AppIcon.appiconset/Contents.json b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/AppIcon.appiconset/Contents.json similarity index 67% rename from DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/AppIcon.appiconset/Contents.json rename to DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/AppIcon.appiconset/Contents.json index 36d2c80..d8db8d6 100644 --- a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "29x29", @@ -30,6 +40,16 @@ "size" : "60x60", "scale" : "3x" }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, { "idiom" : "ipad", "size" : "29x29", @@ -59,6 +79,16 @@ "idiom" : "ipad", "size" : "76x76", "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/Contents.json b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/heart.imageset/Contents.json b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/heart.imageset/Contents.json similarity index 100% rename from DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/heart.imageset/Contents.json rename to DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/heart.imageset/Contents.json diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/heart.imageset/heart.png b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/heart.imageset/heart.png similarity index 100% rename from DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/heart.imageset/heart.png rename to DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/heart.imageset/heart.png diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/like.imageset/Contents.json b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/like.imageset/Contents.json similarity index 100% rename from DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/like.imageset/Contents.json rename to DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/like.imageset/Contents.json diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/like.imageset/like.png b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/like.imageset/like.png similarity index 100% rename from DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/like.imageset/like.png rename to DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/like.imageset/like.png diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/smile.imageset/Contents.json b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/smile.imageset/Contents.json similarity index 100% rename from DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/smile.imageset/Contents.json rename to DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/smile.imageset/Contents.json diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/smile.imageset/smile.png b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/smile.imageset/smile.png similarity index 100% rename from DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/smile.imageset/smile.png rename to DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/smile.imageset/smile.png diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/star.imageset/Contents.json b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/star.imageset/Contents.json similarity index 82% rename from DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/star.imageset/Contents.json rename to DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/star.imageset/Contents.json index 8e0b1a3..9881a38 100644 --- a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/star.imageset/Contents.json +++ b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/star.imageset/Contents.json @@ -6,8 +6,8 @@ }, { "idiom" : "universal", - "scale" : "2x", - "filename" : "star.png" + "filename" : "star.png", + "scale" : "2x" }, { "idiom" : "universal", diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/star.imageset/star.png b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/star.imageset/star.png similarity index 100% rename from DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/star.imageset/star.png rename to DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Images.xcassets/star.imageset/star.png diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Info.plist b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Info.plist similarity index 100% rename from DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Info.plist rename to DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/Info.plist diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/ViewController.swift b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/ViewController.swift similarity index 70% rename from DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/ViewController.swift rename to DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/ViewController.swift index 70c3acd..243f782 100644 --- a/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/ViewController.swift +++ b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew-DEMO/ViewController.swift @@ -7,27 +7,26 @@ // import UIKit -import DOFavoriteButton - +import DOFavoriteButtonNew class ViewController: UIViewController { - @IBOutlet var heartButton: DOFavoriteButton! + @IBOutlet var heartButton: DOFavoriteButtonNew! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. let width = (self.view.frame.width - 44) / 4 var x = width / 2 - let y = self.view.frame.height / 2 - 22 + let y = 100.0 // star button - let starButton = DOFavoriteButton(frame: CGRect(x: x, y: y, width: 44, height: 44), image: UIImage(named: "star")) + let starButton = DOFavoriteButtonNew(frame: CGRect(x: x, y: y, width: 44, height: 44), image: UIImage(named: "star")) starButton.addTarget(self, action: #selector(self.tappedButton), for: .touchUpInside) self.view.addSubview(starButton) x += width // heart button - let heartButton = DOFavoriteButton(frame: CGRect(x: x, y: y, width: 44, height: 44), image: UIImage(named: "heart")) + let heartButton = DOFavoriteButtonNew(frame: CGRect(x: x, y: y, width: 44, height: 44), image: UIImage(named: "heart")) heartButton.imageColorOn = UIColor(red: 254/255, green: 110/255, blue: 111/255, alpha: 1.0) heartButton.circleColor = UIColor(red: 254/255, green: 110/255, blue: 111/255, alpha: 1.0) heartButton.lineColor = UIColor(red: 226/255, green: 96/255, blue: 96/255, alpha: 1.0) @@ -36,7 +35,7 @@ class ViewController: UIViewController { x += width // like button - let likeButton = DOFavoriteButton(frame: CGRect(x: x, y: y, width: 44, height: 44), image: UIImage(named: "like")) + let likeButton = DOFavoriteButtonNew(frame: CGRect(x: x, y: y, width: 44, height: 44), image: UIImage(named: "like")) likeButton.imageColorOn = UIColor(red: 52/255, green: 152/255, blue: 219/255, alpha: 1.0) likeButton.circleColor = UIColor(red: 52/255, green: 152/255, blue: 219/255, alpha: 1.0) likeButton.lineColor = UIColor(red: 41/255, green: 128/255, blue: 185/255, alpha: 1.0) @@ -45,7 +44,7 @@ class ViewController: UIViewController { x += width // smile button - let smileButton = DOFavoriteButton(frame: CGRect(x: x, y: y, width: 44, height: 44), image: UIImage(named: "smile")) + let smileButton = DOFavoriteButtonNew(frame: CGRect(x: x, y: y, width: 44, height: 44), image: UIImage(named: "smile")) smileButton.imageColorOn = UIColor(red: 45/255, green: 204/255, blue: 112/255, alpha: 1.0) smileButton.circleColor = UIColor(red: 45/255, green: 204/255, blue: 112/255, alpha: 1.0) smileButton.lineColor = UIColor(red: 45/255, green: 195/255, blue: 106/255, alpha: 1.0) @@ -54,6 +53,11 @@ class ViewController: UIViewController { self.heartButton.addTarget(self, action: #selector(self.tappedButton), for: .touchUpInside) + + // star button + let bigStarButton = DOFavoriteButtonNew(frame: CGRect(x: (self.view.frame.width - 100.0) / 2.0, y: (self.view.frame.height - 100.0)/2.0 , width: 100, height: 100), image: UIImage(named: "star")) + bigStarButton.addTarget(self, action: #selector(self.tappedButton), for: .touchUpInside) + self.view.addSubview(bigStarButton) } override func didReceiveMemoryWarning() { @@ -61,7 +65,7 @@ class ViewController: UIViewController { // Dispose of any resources that can be recreated. } - func tappedButton(sender: DOFavoriteButton) { + @objc func tappedButton(sender: DOFavoriteButtonNew) { if sender.isSelected { sender.deselect() } else { diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton/DOFavoriteButton.h b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew/DOFavoriteButtonNew.h similarity index 67% rename from DOFavoriteButton-DEMO/DOFavoriteButton/DOFavoriteButton.h rename to DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew/DOFavoriteButtonNew.h index 16abb78..4c2f2e5 100644 --- a/DOFavoriteButton-DEMO/DOFavoriteButton/DOFavoriteButton.h +++ b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew/DOFavoriteButtonNew.h @@ -1,6 +1,6 @@ // -// DOFavoriteButton.h -// DOFavoriteButton +// DOFavoriteButtonNew.h +// DOFavoriteButtonNew // // Created by Daiki Okumura on 2015/07/25. // Copyright (c) 2015 Daiki Okumura. All rights reserved. @@ -9,10 +9,10 @@ #import //! Project version number for DOFavoriteButton. -FOUNDATION_EXPORT double DOFavoriteButtonVersionNumber; +FOUNDATION_EXPORT double DOFavoriteButtonVersionNewNumber; //! Project version string for DOFavoriteButton. -FOUNDATION_EXPORT const unsigned char DOFavoriteButtonVersionString[]; +FOUNDATION_EXPORT const unsigned char DOFavoriteButtonNewVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import diff --git a/DOFavoriteButton-DEMO/DOFavoriteButton/Info.plist b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew/Info.plist similarity index 97% rename from DOFavoriteButton-DEMO/DOFavoriteButton/Info.plist rename to DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew/Info.plist index d3de8ee..2a44702 100644 --- a/DOFavoriteButton-DEMO/DOFavoriteButton/Info.plist +++ b/DOFavoriteButtonNew-DEMO/DOFavoriteButtonNew/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.0 + 0.0.5 CFBundleSignature ???? CFBundleVersion diff --git a/DOFavoriteButtonNew.podspec b/DOFavoriteButtonNew.podspec new file mode 100644 index 0000000..4012fa2 --- /dev/null +++ b/DOFavoriteButtonNew.podspec @@ -0,0 +1,17 @@ +Pod::Spec.new do |s| + s.name = "DOFavoriteButtonNew" + s.version = "0.0.6" + s.swift_versions = "5.0" + s.summary = "Cute Animated Button written in Swift. It could be just right for favorite buttons!" + s.homepage = "https://github.com/ghostlordstar/DOFavoriteButton.git" + s.screenshots = "https://raw.githubusercontent.com/okmr-d/okmr-d.github.io/master/img/DOFavoriteButton/demo.gif" + s.license = { :type => "MIT", :file => "LICENSE" } + s.author = { "ghostlord" => "heshanzhang@outlook.com" } + s.social_media_url = "http://ghostlordstar.github.io" + s.platform = :ios, "8.0" + s.source = { :git => "https://github.com/ghostlordstar/DOFavoriteButton.git", :tag => s.version.to_s } + s.source_files = "DOFavoriteButtonNew/*.swift" + s.resources = "DOFavoriteButtonNew/*.png" + s.framework = "UIKit" + s.requires_arc = true +end diff --git a/DOFavoriteButton/DOFavoriteButton.swift b/DOFavoriteButtonNew/DOFavoriteButtonNew.swift similarity index 91% rename from DOFavoriteButton/DOFavoriteButton.swift rename to DOFavoriteButtonNew/DOFavoriteButtonNew.swift index 47e6d9d..6e7d526 100644 --- a/DOFavoriteButton/DOFavoriteButton.swift +++ b/DOFavoriteButtonNew/DOFavoriteButtonNew.swift @@ -1,6 +1,6 @@ // -// DOFavoriteButton.swift -// DOFavoriteButton +// DOFavoriteButtonNew.swift +// DOFavoriteButtonNew // // Created by Daiki Okumura on 2015/07/09. // Copyright (c) 2015 Daiki Okumura. All rights reserved. @@ -12,7 +12,7 @@ import UIKit @IBDesignable -open class DOFavoriteButton: UIButton { +open class DOFavoriteButtonNew: UIButton { fileprivate var imageShape: CAShapeLayer! @IBInspectable open var image: UIImage! { @@ -124,11 +124,11 @@ open class DOFavoriteButton: UIButton { circleMask = CAShapeLayer() circleMask.bounds = imageFrame circleMask.position = imgCenterPoint - circleMask.fillRule = kCAFillRuleEvenOdd + circleMask.fillRule = CAShapeLayerFillRule.evenOdd circleShape.mask = circleMask let maskPath = UIBezierPath(rect: imageFrame) - maskPath.addArc(withCenter: imgCenterPoint, radius: 0.1, startAngle: CGFloat(0.0), endAngle: CGFloat(M_PI * 2), clockwise: true) + maskPath.addArc(withCenter: imgCenterPoint, radius: 0.1, startAngle: CGFloat(0.0), endAngle: CGFloat(Double.pi * 2), clockwise: true) circleMask.path = maskPath.cgPath //=============== @@ -150,12 +150,12 @@ open class DOFavoriteButton: UIButton { path.addLine(to: CGPoint(x: lineFrame.origin.x + lineFrame.width / 2, y: lineFrame.origin.y)) return path }() - line.lineCap = kCALineCapRound - line.lineJoin = kCALineJoinRound + line.lineCap = CAShapeLayerLineCap.round + line.lineJoin = CAShapeLayerLineJoin.round line.strokeStart = 0.0 line.strokeEnd = 0.0 line.opacity = 0.0 - line.transform = CATransform3DMakeRotation(CGFloat(M_PI) / 5 * (CGFloat(i) * 2 + 1), 0.0, 0.0, 1.0) + line.transform = CATransform3DMakeRotation(CGFloat(Double.pi) / 5 * (CGFloat(i) * 2 + 1), 0.0, 0.0, 1.0) self.layer.addSublayer(line) lines.append(line) } @@ -338,26 +338,26 @@ open class DOFavoriteButton: UIButton { //=============== // add target //=============== - self.addTarget(self, action: #selector(DOFavoriteButton.touchDown(_:)), for: UIControlEvents.touchDown) - self.addTarget(self, action: #selector(DOFavoriteButton.touchUpInside(_:)), for: UIControlEvents.touchUpInside) - self.addTarget(self, action: #selector(DOFavoriteButton.touchDragExit(_:)), for: UIControlEvents.touchDragExit) - self.addTarget(self, action: #selector(DOFavoriteButton.touchDragEnter(_:)), for: UIControlEvents.touchDragEnter) - self.addTarget(self, action: #selector(DOFavoriteButton.touchCancel(_:)), for: UIControlEvents.touchCancel) + self.addTarget(self, action: #selector(DOFavoriteButtonNew.touchDown(_:)), for: .touchDown) + self.addTarget(self, action: #selector(DOFavoriteButtonNew.touchUpInside(_:)), for: .touchUpInside) + self.addTarget(self, action: #selector(DOFavoriteButtonNew.touchDragExit(_:)), for: .touchDragExit) + self.addTarget(self, action: #selector(DOFavoriteButtonNew.touchDragEnter(_:)), for: .touchDragEnter) + self.addTarget(self, action: #selector(DOFavoriteButtonNew.touchCancel(_:)), for: .touchCancel) } - func touchDown(_ sender: DOFavoriteButton) { + @objc func touchDown(_ sender: DOFavoriteButtonNew) { self.layer.opacity = 0.4 } - func touchUpInside(_ sender: DOFavoriteButton) { + @objc func touchUpInside(_ sender: DOFavoriteButtonNew) { self.layer.opacity = 1.0 } - func touchDragExit(_ sender: DOFavoriteButton) { + @objc func touchDragExit(_ sender: DOFavoriteButtonNew) { self.layer.opacity = 1.0 } - func touchDragEnter(_ sender: DOFavoriteButton) { + @objc func touchDragEnter(_ sender: DOFavoriteButtonNew) { self.layer.opacity = 0.4 } - func touchCancel(_ sender: DOFavoriteButton) { + @objc func touchCancel(_ sender: DOFavoriteButtonNew) { self.layer.opacity = 1.0 } diff --git a/DOFavoriteButton/heart.png b/DOFavoriteButtonNew/heart.png similarity index 100% rename from DOFavoriteButton/heart.png rename to DOFavoriteButtonNew/heart.png diff --git a/DOFavoriteButton/like.png b/DOFavoriteButtonNew/like.png similarity index 100% rename from DOFavoriteButton/like.png rename to DOFavoriteButtonNew/like.png diff --git a/DOFavoriteButton/smile.png b/DOFavoriteButtonNew/smile.png similarity index 100% rename from DOFavoriteButton/smile.png rename to DOFavoriteButtonNew/smile.png diff --git a/DOFavoriteButton/star.png b/DOFavoriteButtonNew/star.png similarity index 100% rename from DOFavoriteButton/star.png rename to DOFavoriteButtonNew/star.png diff --git a/README.md b/README.md index 4d402b7..d2d2325 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,35 @@ -# DOFavoriteButton +# DOFavoriteButtonNew [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) -[![Version](https://img.shields.io/cocoapods/v/DOFavoriteButton.svg?style=flat)](http://cocoapods.org/pods/DOFavoriteButton) -[![Platform](https://img.shields.io/cocoapods/p/DOFavoriteButton.svg?style=flat)](http://cocoapods.org/pods/DOFavoriteButton) -[![License](https://img.shields.io/cocoapods/l/DOFavoriteButton.svg?style=flat)](https://github.com/okmr-d/DOFavoriteButton/blob/master/LICENSE) +[![Version](https://img.shields.io/cocoapods/v/DOFavoriteButtonNew.svg?style=flat)](http://cocoapods.org/pods/DOFavoriteButtonNew) +[![Platform](https://img.shields.io/cocoapods/p/DOFavoriteButtonNew.svg?style=flat)](http://cocoapods.org/pods/DOFavoriteButtonNew) +[![License](https://img.shields.io/cocoapods/l/DOFavoriteButtonNew.svg?style=flat)](https://github.com/ghostlordstar/DOFavoriteButton/blob/master/LICENSE) Cute Animated Button written in Swift. It could be just right for favorite buttons! ![Demo](https://raw.githubusercontent.com/okmr-d/okmr-d.github.io/master/img/DOFavoriteButton/demo.gif) +## Statement +DOFavoriteButton-new is based on the [DOFavoriteButton](https://github.com/okmr-d/DOFavoriteButton). + ## Requirements -* iOS 7.0+ -* Swift 1.2 +* iOS 8.0+ +* Swift 5.0 ## Installation #### Carthage Add the following line to your `Cartfile`: ``` -github "okmr-d/DOFavoriteButton" +github "ghostlordstar/DOFavoriteButtonNew" ``` #### CocoaPods Add the following line to your `Podfile`: ``` -pod 'DOFavoriteButton' +pod 'DOFavoriteButtonNew' ``` #### Manual -Just drag DOFavoriteButton.swift to your project. +Just drag DOFavoriteButtonNew.swift to your project. ## How to use #### 1. Add a flat icon image @@ -35,12 +38,12 @@ Just drag DOFavoriteButton.swift to your project. #### 2. Create a button ##### ・By coding ```swift -let button = DOFavoriteButton(frame: CGRectMake(0, 0, 44, 44), image: UIImage(named: "star.png")) +let button = DOFavoriteButtonNew(frame: CGRect(x: 100, y:100, width: 44, height: 44), image: UIImage(named: "star.png")) self.view.addSubview(button) ``` ##### ・By using Storyboard or XIB -1. Add Button object and set Custom Class `DOFavoriteButton` +1. Add Button object and set Custom Class `DOFavoriteButtonNew` ![via Storyboard](https://raw.githubusercontent.com/okmr-d/okmr-d.github.io/master/img/DOFavoriteButton/storyboard.png) 2. Connect Outlet @@ -48,18 +51,18 @@ self.view.addSubview(button) #### 3. Add tapped function ```swift -button.addTarget(self, action: Selector("tapped:"), forControlEvents: .TouchUpInside) +button.addTarget(self, action: #selector(tapped(sender:)), for: UIControl.Event.touchUpInside) ``` ```swift -func tapped(sender: DOFavoriteButton) { - if sender.selected { - // deselect - sender.deselect() - } else { - // select with animation - sender.select() +@objc func tapped(sender: DOFavoriteButtonNew) { + if sender.isSelected { + // deselect + sender.deselect() + } else { + // select with animation + sender.select() + } } -} ``` ## Customize @@ -78,7 +81,7 @@ Result: There is a demo project added to this repository, so you can see how it works. ## Credit/Inspiration -DOFavoriteButton was inspired by [Twitter's iOS App](https://itunes.apple.com/us/app/twitter/id333903271). +DOFavoriteButtonNew was inspired by [Twitter's iOS App](https://itunes.apple.com/us/app/twitter/id333903271). ## License This software is released under the MIT License.