├── DOFavoriteButton
├── heart.png
├── like.png
├── smile.png
├── star.png
└── DOFavoriteButton.swift
├── DOFavoriteButton-DEMO
├── DOFavoriteButton-DEMO
│ ├── Images.xcassets
│ │ ├── like.imageset
│ │ │ ├── like.png
│ │ │ └── Contents.json
│ │ ├── star.imageset
│ │ │ ├── star.png
│ │ │ └── Contents.json
│ │ ├── heart.imageset
│ │ │ ├── heart.png
│ │ │ └── Contents.json
│ │ ├── smile.imageset
│ │ │ ├── smile.png
│ │ │ └── Contents.json
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Info.plist
│ ├── AppDelegate.swift
│ ├── ViewController.swift
│ └── Base.lproj
│ │ ├── LaunchScreen.xib
│ │ └── Main.storyboard
├── DOFavoriteButton-DEMO.xcodeproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ ├── xcshareddata
│ │ └── xcschemes
│ │ │ └── DOFavoriteButton.xcscheme
│ └── project.pbxproj
└── DOFavoriteButton
│ ├── DOFavoriteButton.h
│ └── Info.plist
├── .gitignore
├── DOFavoriteButton.podspec
├── LICENSE
└── README.md
/DOFavoriteButton/heart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yoavlt/DOFavoriteButton/HEAD/DOFavoriteButton/heart.png
--------------------------------------------------------------------------------
/DOFavoriteButton/like.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yoavlt/DOFavoriteButton/HEAD/DOFavoriteButton/like.png
--------------------------------------------------------------------------------
/DOFavoriteButton/smile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yoavlt/DOFavoriteButton/HEAD/DOFavoriteButton/smile.png
--------------------------------------------------------------------------------
/DOFavoriteButton/star.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yoavlt/DOFavoriteButton/HEAD/DOFavoriteButton/star.png
--------------------------------------------------------------------------------
/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/like.imageset/like.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yoavlt/DOFavoriteButton/HEAD/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/like.imageset/like.png
--------------------------------------------------------------------------------
/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/star.imageset/star.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yoavlt/DOFavoriteButton/HEAD/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/star.imageset/star.png
--------------------------------------------------------------------------------
/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/heart.imageset/heart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yoavlt/DOFavoriteButton/HEAD/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/heart.imageset/heart.png
--------------------------------------------------------------------------------
/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/smile.imageset/smile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yoavlt/DOFavoriteButton/HEAD/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/smile.imageset/smile.png
--------------------------------------------------------------------------------
/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/heart.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "heart.png"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/like.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "like.png"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/smile.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "smile.png"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/star.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "star.png"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/DOFavoriteButton-DEMO/DOFavoriteButton/DOFavoriteButton.h:
--------------------------------------------------------------------------------
1 | //
2 | // DOFavoriteButton.h
3 | // DOFavoriteButton
4 | //
5 | // Created by Daiki Okumura on 2015/07/25.
6 | // Copyright (c) 2015 Daiki Okumura. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | //! Project version number for DOFavoriteButton.
12 | FOUNDATION_EXPORT double DOFavoriteButtonVersionNumber;
13 |
14 | //! Project version string for DOFavoriteButton.
15 | FOUNDATION_EXPORT const unsigned char DOFavoriteButtonVersionString[];
16 |
17 | // In this header, you should import all the public headers of your framework using statements like #import
18 |
19 |
20 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | build/
4 | *.pbxuser
5 | !default.pbxuser
6 | *.mode1v3
7 | !default.mode1v3
8 | *.mode2v3
9 | !default.mode2v3
10 | *.perspectivev3
11 | !default.perspectivev3
12 | xcuserdata
13 | *.xccheckout
14 | *.moved-aside
15 | DerivedData
16 | *.hmap
17 | *.ipa
18 | *.xcuserstate
19 |
20 | # CocoaPods
21 | #
22 | # We recommend against adding the Pods directory to your .gitignore. However
23 | # you should judge for yourself, the pros and cons are mentioned at:
24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
25 | #
26 | # Pods/
27 |
28 | # Carthage
29 | #
30 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
31 | # Carthage/Checkouts
32 |
33 | Carthage/Build
34 |
--------------------------------------------------------------------------------
/DOFavoriteButton.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = "DOFavoriteButton"
3 | s.version = "0.0.4"
4 | s.summary = "Cute Animated Button written in Swift. It could be just right for favorite buttons!"
5 | s.homepage = "https://github.com/okmr-d/DOFavoriteButton"
6 | s.screenshots = "https://raw.githubusercontent.com/okmr-d/okmr-d.github.io/master/img/DOFavoriteButton/demo.gif"
7 | s.license = { :type => "MIT", :file => "LICENSE" }
8 | s.author = { "Daiki Okumura" => "daiki.okumura@gmail.com" }
9 | s.social_media_url = "http://twitter.com/okmr_d"
10 | s.platform = :ios, "8.0"
11 | s.source = { :git => "https://github.com/okmr-d/DOFavoriteButton.git", :tag => s.version.to_s }
12 | s.source_files = "DOFavoriteButton/*.swift"
13 | s.resources = "DOFavoriteButton/*.png"
14 | s.framework = "UIKit"
15 | s.requires_arc = true
16 | end
17 |
--------------------------------------------------------------------------------
/DOFavoriteButton-DEMO/DOFavoriteButton/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Daiki Okumura
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "ipad",
35 | "size" : "29x29",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "29x29",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "40x40",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "40x40",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "76x76",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "76x76",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
--------------------------------------------------------------------------------
/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // DOFavoriteButton-DEMO
4 | //
5 | // Created by Daiki Okumura on 2015/07/09.
6 | // Copyright (c) 2015 Daiki Okumura. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
18 | // Override point for customization after application launch.
19 | return true
20 | }
21 |
22 | func applicationWillResignActive(application: UIApplication) {
23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
25 | }
26 |
27 | func applicationDidEnterBackground(application: UIApplication) {
28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30 | }
31 |
32 | func applicationWillEnterForeground(application: UIApplication) {
33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
34 | }
35 |
36 | func applicationDidBecomeActive(application: UIApplication) {
37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
38 | }
39 |
40 | func applicationWillTerminate(application: UIApplication) {
41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42 | }
43 |
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DOFavoriteButton
2 | [](https://github.com/Carthage/Carthage)
3 | [](http://cocoapods.org/pods/DOFavoriteButton)
4 | [](http://cocoapods.org/pods/DOFavoriteButton)
5 | [](https://github.com/okmr-d/DOFavoriteButton/blob/master/LICENSE)
6 |
7 | Cute Animated Button written in Swift.
8 | It could be just right for favorite buttons!
9 | 
10 |
11 | ## Requirements
12 | * iOS 7.0+
13 | * Swift 1.2
14 |
15 | ## Installation
16 | #### Carthage
17 | Add the following line to your `Cartfile`:
18 | ```
19 | github "okmr-d/DOFavoriteButton"
20 | ```
21 |
22 | #### CocoaPods
23 | Add the following line to your `Podfile`:
24 | ```
25 | pod 'DOFavoriteButton'
26 | ```
27 |
28 | #### Manual
29 | Just drag DOFavoriteButton.swift to your project.
30 |
31 | ## How to use
32 | #### 1. Add a flat icon image
33 | 
34 |
35 | #### 2. Create a button
36 | ##### ・By coding
37 | ```swift
38 | let button = DOFavoriteButton(frame: CGRectMake(0, 0, 44, 44), image: UIImage(named: "star.png"))
39 | self.view.addSubview(button)
40 | ```
41 |
42 | ##### ・By using Storyboard or XIB
43 | 1. Add Button object and set Custom Class `DOFavoriteButton`
44 | 
45 |
46 | 2. Connect Outlet
47 | 
48 |
49 | #### 3. Add tapped function
50 | ```swift
51 | button.addTarget(self, action: Selector("tapped:"), forControlEvents: .TouchUpInside)
52 | ```
53 | ```swift
54 | func tapped(sender: DOFavoriteButton) {
55 | if sender.selected {
56 | // deselect
57 | sender.deselect()
58 | } else {
59 | // select with animation
60 | sender.select()
61 | }
62 | }
63 | ```
64 |
65 | ## Customize
66 | You can change button color & animation duration:
67 | ```swift
68 | button.imageColorOff = UIColor.brownColor()
69 | button.imageColorOn = UIColor.redColor()
70 | button.circleColor = UIColor.greenColor()
71 | button.lineColor = UIColor.blueColor()
72 | button.duration = 3.0 // default: 1.0
73 | ```
74 | Result:
75 | 
76 |
77 | ## DEMO
78 | There is a demo project added to this repository, so you can see how it works.
79 |
80 | ## Credit/Inspiration
81 | DOFavoriteButton was inspired by [Twitter's iOS App](https://itunes.apple.com/us/app/twitter/id333903271).
82 |
83 | ## License
84 | This software is released under the MIT License.
85 |
--------------------------------------------------------------------------------
/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO.xcodeproj/xcshareddata/xcschemes/DOFavoriteButton.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
34 |
35 |
45 |
46 |
52 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
70 |
71 |
72 |
73 |
75 |
76 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // DOFavoriteButton-DEMO
4 | //
5 | // Created by Daiki Okumura on 2015/07/09.
6 | // Copyright (c) 2015 Daiki Okumura. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import DOFavoriteButton
11 |
12 | class ViewController: UIViewController {
13 |
14 | @IBOutlet var heartButton: DOFavoriteButton!
15 | override func viewDidLoad() {
16 | super.viewDidLoad()
17 | // Do any additional setup after loading the view, typically from a nib.
18 |
19 | let width = (self.view.frame.width - 44) / 4
20 | var x = width / 2
21 | let y = self.view.frame.height / 2 - 22
22 |
23 | // star button
24 | let starButton = DOFavoriteButton(frame: CGRectMake(x, y, 44, 44), image: UIImage(named: "star"))
25 | starButton.addTarget(self, action: Selector("tappedButton:"), forControlEvents: UIControlEvents.TouchUpInside)
26 | self.view.addSubview(starButton)
27 | x += width
28 |
29 | // heart button
30 | let heartButton = DOFavoriteButton(frame: CGRectMake(x, y, 44, 44), image: UIImage(named: "heart"))
31 | heartButton.imageColorOn = UIColor(red: 254/255, green: 110/255, blue: 111/255, alpha: 1.0)
32 | heartButton.circleColor = UIColor(red: 254/255, green: 110/255, blue: 111/255, alpha: 1.0)
33 | heartButton.lineColor = UIColor(red: 226/255, green: 96/255, blue: 96/255, alpha: 1.0)
34 | heartButton.addTarget(self, action: Selector("tappedButton:"), forControlEvents: UIControlEvents.TouchUpInside)
35 | self.view.addSubview(heartButton)
36 | x += width
37 |
38 | // like button
39 | let likeButton = DOFavoriteButton(frame: CGRectMake(x, y, 44, 44), image: UIImage(named: "like"))
40 | likeButton.imageColorOn = UIColor(red: 52/255, green: 152/255, blue: 219/255, alpha: 1.0)
41 | likeButton.circleColor = UIColor(red: 52/255, green: 152/255, blue: 219/255, alpha: 1.0)
42 | likeButton.lineColor = UIColor(red: 41/255, green: 128/255, blue: 185/255, alpha: 1.0)
43 | likeButton.addTarget(self, action: Selector("tappedButton:"), forControlEvents: UIControlEvents.TouchUpInside)
44 | self.view.addSubview(likeButton)
45 | x += width
46 |
47 | // smile button
48 | let smileButton = DOFavoriteButton(frame: CGRectMake(x, y, 44, 44), image: UIImage(named: "smile"))
49 | smileButton.imageColorOn = UIColor(red: 45/255, green: 204/255, blue: 112/255, alpha: 1.0)
50 | smileButton.circleColor = UIColor(red: 45/255, green: 204/255, blue: 112/255, alpha: 1.0)
51 | smileButton.lineColor = UIColor(red: 45/255, green: 195/255, blue: 106/255, alpha: 1.0)
52 | smileButton.addTarget(self, action: Selector("tappedButton:"), forControlEvents: UIControlEvents.TouchUpInside)
53 | self.view.addSubview(smileButton)
54 |
55 | self.heartButton.addTarget(self, action: Selector("tappedButton:"), forControlEvents: UIControlEvents.TouchUpInside)
56 | }
57 |
58 | override func didReceiveMemoryWarning() {
59 | super.didReceiveMemoryWarning()
60 | // Dispose of any resources that can be recreated.
61 | }
62 |
63 | func tappedButton(sender: DOFavoriteButton) {
64 | if sender.selected {
65 | sender.deselect()
66 | } else {
67 | sender.select()
68 | }
69 | }
70 | }
71 |
72 |
--------------------------------------------------------------------------------
/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
22 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
43 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/DOFavoriteButton/DOFavoriteButton.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DOFavoriteButton.swift
3 | // DOFavoriteButton
4 | //
5 | // Created by Daiki Okumura on 2015/07/09.
6 | // Copyright (c) 2015 Daiki Okumura. All rights reserved.
7 | //
8 | // This software is released under the MIT License.
9 | // http://opensource.org/licenses/mit-license.php
10 | //
11 |
12 | import UIKit
13 |
14 | @IBDesignable
15 | public class DOFavoriteButton: UIButton {
16 |
17 | private var imageShape: CAShapeLayer!
18 | @IBInspectable public var image: UIImage! {
19 | didSet {
20 | createLayers(image: image)
21 | }
22 | }
23 | @IBInspectable public var imageColorOn: UIColor! = UIColor(red: 255/255, green: 172/255, blue: 51/255, alpha: 1.0) {
24 | didSet {
25 | if (selected) {
26 | imageShape.fillColor = imageColorOn.CGColor
27 | }
28 | }
29 | }
30 | @IBInspectable public var imageColorOff: UIColor! = UIColor(red: 136/255, green: 153/255, blue: 166/255, alpha: 1.0) {
31 | didSet {
32 | if (!selected) {
33 | imageShape.fillColor = imageColorOff.CGColor
34 | }
35 | }
36 | }
37 |
38 | private var circleShape: CAShapeLayer!
39 | private var circleMask: CAShapeLayer!
40 | @IBInspectable public var circleColor: UIColor! = UIColor(red: 255/255, green: 172/255, blue: 51/255, alpha: 1.0) {
41 | didSet {
42 | circleShape.fillColor = circleColor.CGColor
43 | }
44 | }
45 |
46 | private var lines: [CAShapeLayer]!
47 | @IBInspectable public var lineColor: UIColor! = UIColor(red: 250/255, green: 120/255, blue: 68/255, alpha: 1.0) {
48 | didSet {
49 | for line in lines {
50 | line.strokeColor = lineColor.CGColor
51 | }
52 | }
53 | }
54 |
55 | private let circleTransform = CAKeyframeAnimation(keyPath: "transform")
56 | private let circleMaskTransform = CAKeyframeAnimation(keyPath: "transform")
57 | private let lineStrokeStart = CAKeyframeAnimation(keyPath: "strokeStart")
58 | private let lineStrokeEnd = CAKeyframeAnimation(keyPath: "strokeEnd")
59 | private let lineOpacity = CAKeyframeAnimation(keyPath: "opacity")
60 | private let imageTransform = CAKeyframeAnimation(keyPath: "transform")
61 |
62 | @IBInspectable public var duration: Double = 1.0 {
63 | didSet {
64 | circleTransform.duration = 0.333 * duration // 0.0333 * 10
65 | circleMaskTransform.duration = 0.333 * duration // 0.0333 * 10
66 | lineStrokeStart.duration = 0.6 * duration //0.0333 * 18
67 | lineStrokeEnd.duration = 0.6 * duration //0.0333 * 18
68 | lineOpacity.duration = 1.0 * duration //0.0333 * 30
69 | imageTransform.duration = 1.0 * duration //0.0333 * 30
70 | }
71 | }
72 |
73 | override public var selected : Bool {
74 | didSet {
75 | if (selected != oldValue) {
76 | if selected {
77 | imageShape.fillColor = imageColorOn.CGColor
78 | } else {
79 | deselect()
80 | }
81 | }
82 | }
83 | }
84 |
85 | public convenience init() {
86 | self.init(frame: CGRectZero)
87 | }
88 |
89 | public override convenience init(frame: CGRect) {
90 | self.init(frame: frame, image: UIImage())
91 | }
92 |
93 | public init(frame: CGRect, image: UIImage!) {
94 | super.init(frame: frame)
95 | self.image = image
96 | createLayers(image: image)
97 | addTargets()
98 | }
99 |
100 | public required init?(coder aDecoder: NSCoder) {
101 | super.init(coder: aDecoder)
102 | createLayers(image: UIImage())
103 | addTargets()
104 | }
105 |
106 | private func createLayers(image image: UIImage!) {
107 | self.layer.sublayers = nil
108 |
109 | let imageFrame = CGRect(x: frame.size.width / 2 - image.size.width / 2, y: frame.size.height / 2 - image.size.height / 2, width: image.size.width, height: image.size.height)
110 | let imgCenterPoint = CGPointMake(CGRectGetMidX(imageFrame), CGRectGetMidY(imageFrame))
111 | let lineFrame = CGRectMake(imageFrame.origin.x - imageFrame.width / 4, imageFrame.origin.y - imageFrame.height / 4 , imageFrame.width * 1.5, imageFrame.height * 1.5)
112 |
113 | // let imageFrame = CGRectMake(frame.size.width / 2 - frame.size.width / 4, frame.size.height / 2 - frame.size.height / 4, frame.size.width / 2, frame.size.height / 2)
114 |
115 | //===============
116 | // circle layer
117 | //===============
118 | circleShape = CAShapeLayer()
119 | circleShape.bounds = imageFrame
120 | circleShape.position = imgCenterPoint
121 | circleShape.path = UIBezierPath(ovalInRect: imageFrame).CGPath
122 | circleShape.fillColor = circleColor.CGColor
123 | circleShape.transform = CATransform3DMakeScale(0.0, 0.0, 1.0)
124 | self.layer.addSublayer(circleShape)
125 |
126 | circleMask = CAShapeLayer()
127 | circleMask.bounds = imageFrame
128 | circleMask.position = imgCenterPoint
129 | circleMask.fillRule = kCAFillRuleEvenOdd
130 | circleShape.mask = circleMask
131 |
132 | let maskPath = UIBezierPath(rect: imageFrame)
133 | maskPath.addArcWithCenter(imgCenterPoint, radius: 0.1, startAngle: CGFloat(0.0), endAngle: CGFloat(M_PI * 2), clockwise: true)
134 | circleMask.path = maskPath.CGPath
135 |
136 | //===============
137 | // line layer
138 | //===============
139 | lines = []
140 | for i in 0 ..< 5 {
141 | let line = CAShapeLayer()
142 | line.bounds = lineFrame
143 | line.position = imgCenterPoint
144 | line.masksToBounds = true
145 | line.actions = ["strokeStart": NSNull(), "strokeEnd": NSNull()]
146 | line.strokeColor = lineColor.CGColor
147 | line.lineWidth = 1.25
148 | line.miterLimit = 1.25
149 | line.path = {
150 | let path = CGPathCreateMutable()
151 | CGPathMoveToPoint(path, nil, CGRectGetMidX(lineFrame), CGRectGetMidY(lineFrame))
152 | CGPathAddLineToPoint(path, nil, lineFrame.origin.x + lineFrame.width / 2, lineFrame.origin.y)
153 | return path
154 | }()
155 | line.lineCap = kCALineCapRound
156 | line.lineJoin = kCALineJoinRound
157 | line.strokeStart = 0.0
158 | line.strokeEnd = 0.0
159 | line.opacity = 0.0
160 | line.transform = CATransform3DMakeRotation(CGFloat(M_PI) / 5 * (CGFloat(i) * 2 + 1), 0.0, 0.0, 1.0)
161 | self.layer.addSublayer(line)
162 | lines.append(line)
163 | }
164 |
165 | //===============
166 | // image layer
167 | //===============
168 | imageShape = CAShapeLayer()
169 | imageShape.bounds = imageFrame
170 | imageShape.position = imgCenterPoint
171 | imageShape.path = UIBezierPath(rect: imageFrame).CGPath
172 | imageShape.fillColor = imageColorOff.CGColor
173 | imageShape.actions = ["fillColor": NSNull()]
174 | self.layer.addSublayer(imageShape)
175 |
176 | imageShape.mask = CALayer()
177 | imageShape.mask!.contents = image.CGImage
178 | imageShape.mask!.bounds = imageFrame
179 | imageShape.mask!.position = imgCenterPoint
180 |
181 | //==============================
182 | // circle transform animation
183 | //==============================
184 | circleTransform.duration = 0.333 // 0.0333 * 10
185 | circleTransform.values = [
186 | NSValue(CATransform3D: CATransform3DMakeScale(0.0, 0.0, 1.0)), // 0/10
187 | NSValue(CATransform3D: CATransform3DMakeScale(0.5, 0.5, 1.0)), // 1/10
188 | NSValue(CATransform3D: CATransform3DMakeScale(1.0, 1.0, 1.0)), // 2/10
189 | NSValue(CATransform3D: CATransform3DMakeScale(1.2, 1.2, 1.0)), // 3/10
190 | NSValue(CATransform3D: CATransform3DMakeScale(1.3, 1.3, 1.0)), // 4/10
191 | NSValue(CATransform3D: CATransform3DMakeScale(1.37, 1.37, 1.0)), // 5/10
192 | NSValue(CATransform3D: CATransform3DMakeScale(1.4, 1.4, 1.0)), // 6/10
193 | NSValue(CATransform3D: CATransform3DMakeScale(1.4, 1.4, 1.0)) // 10/10
194 | ]
195 | circleTransform.keyTimes = [
196 | 0.0, // 0/10
197 | 0.1, // 1/10
198 | 0.2, // 2/10
199 | 0.3, // 3/10
200 | 0.4, // 4/10
201 | 0.5, // 5/10
202 | 0.6, // 6/10
203 | 1.0 // 10/10
204 | ]
205 |
206 | circleMaskTransform.duration = 0.333 // 0.0333 * 10
207 | circleMaskTransform.values = [
208 | NSValue(CATransform3D: CATransform3DIdentity), // 0/10
209 | NSValue(CATransform3D: CATransform3DIdentity), // 2/10
210 | NSValue(CATransform3D: CATransform3DMakeScale(imageFrame.width * 1.25, imageFrame.height * 1.25, 1.0)), // 3/10
211 | NSValue(CATransform3D: CATransform3DMakeScale(imageFrame.width * 2.688, imageFrame.height * 2.688, 1.0)), // 4/10
212 | NSValue(CATransform3D: CATransform3DMakeScale(imageFrame.width * 3.923, imageFrame.height * 3.923, 1.0)), // 5/10
213 | NSValue(CATransform3D: CATransform3DMakeScale(imageFrame.width * 4.375, imageFrame.height * 4.375, 1.0)), // 6/10
214 | NSValue(CATransform3D: CATransform3DMakeScale(imageFrame.width * 4.731, imageFrame.height * 4.731, 1.0)), // 7/10
215 | NSValue(CATransform3D: CATransform3DMakeScale(imageFrame.width * 5.0, imageFrame.height * 5.0, 1.0)), // 9/10
216 | NSValue(CATransform3D: CATransform3DMakeScale(imageFrame.width * 5.0, imageFrame.height * 5.0, 1.0)) // 10/10
217 | ]
218 | circleMaskTransform.keyTimes = [
219 | 0.0, // 0/10
220 | 0.2, // 2/10
221 | 0.3, // 3/10
222 | 0.4, // 4/10
223 | 0.5, // 5/10
224 | 0.6, // 6/10
225 | 0.7, // 7/10
226 | 0.9, // 9/10
227 | 1.0 // 10/10
228 | ]
229 |
230 | //==============================
231 | // line stroke animation
232 | //==============================
233 | lineStrokeStart.duration = 0.6 //0.0333 * 18
234 | lineStrokeStart.values = [
235 | 0.0, // 0/18
236 | 0.0, // 1/18
237 | 0.18, // 2/18
238 | 0.2, // 3/18
239 | 0.26, // 4/18
240 | 0.32, // 5/18
241 | 0.4, // 6/18
242 | 0.6, // 7/18
243 | 0.71, // 8/18
244 | 0.89, // 17/18
245 | 0.92 // 18/18
246 | ]
247 | lineStrokeStart.keyTimes = [
248 | 0.0, // 0/18
249 | 0.056, // 1/18
250 | 0.111, // 2/18
251 | 0.167, // 3/18
252 | 0.222, // 4/18
253 | 0.278, // 5/18
254 | 0.333, // 6/18
255 | 0.389, // 7/18
256 | 0.444, // 8/18
257 | 0.944, // 17/18
258 | 1.0, // 18/18
259 | ]
260 |
261 | lineStrokeEnd.duration = 0.6 //0.0333 * 18
262 | lineStrokeEnd.values = [
263 | 0.0, // 0/18
264 | 0.0, // 1/18
265 | 0.32, // 2/18
266 | 0.48, // 3/18
267 | 0.64, // 4/18
268 | 0.68, // 5/18
269 | 0.92, // 17/18
270 | 0.92 // 18/18
271 | ]
272 | lineStrokeEnd.keyTimes = [
273 | 0.0, // 0/18
274 | 0.056, // 1/18
275 | 0.111, // 2/18
276 | 0.167, // 3/18
277 | 0.222, // 4/18
278 | 0.278, // 5/18
279 | 0.944, // 17/18
280 | 1.0, // 18/18
281 | ]
282 |
283 | lineOpacity.duration = 1.0 //0.0333 * 30
284 | lineOpacity.values = [
285 | 1.0, // 0/30
286 | 1.0, // 12/30
287 | 0.0 // 17/30
288 | ]
289 | lineOpacity.keyTimes = [
290 | 0.0, // 0/30
291 | 0.4, // 12/30
292 | 0.567 // 17/30
293 | ]
294 |
295 | //==============================
296 | // image transform animation
297 | //==============================
298 | imageTransform.duration = 1.0 //0.0333 * 30
299 | imageTransform.values = [
300 | NSValue(CATransform3D: CATransform3DMakeScale(0.0, 0.0, 1.0)), // 0/30
301 | NSValue(CATransform3D: CATransform3DMakeScale(0.0, 0.0, 1.0)), // 3/30
302 | NSValue(CATransform3D: CATransform3DMakeScale(1.2, 1.2, 1.0)), // 9/30
303 | NSValue(CATransform3D: CATransform3DMakeScale(1.25, 1.25, 1.0)), // 10/30
304 | NSValue(CATransform3D: CATransform3DMakeScale(1.2, 1.2, 1.0)), // 11/30
305 | NSValue(CATransform3D: CATransform3DMakeScale(0.9, 0.9, 1.0)), // 14/30
306 | NSValue(CATransform3D: CATransform3DMakeScale(0.875, 0.875, 1.0)), // 15/30
307 | NSValue(CATransform3D: CATransform3DMakeScale(0.875, 0.875, 1.0)), // 16/30
308 | NSValue(CATransform3D: CATransform3DMakeScale(0.9, 0.9, 1.0)), // 17/30
309 | NSValue(CATransform3D: CATransform3DMakeScale(1.013, 1.013, 1.0)), // 20/30
310 | NSValue(CATransform3D: CATransform3DMakeScale(1.025, 1.025, 1.0)), // 21/30
311 | NSValue(CATransform3D: CATransform3DMakeScale(1.013, 1.013, 1.0)), // 22/30
312 | NSValue(CATransform3D: CATransform3DMakeScale(0.96, 0.96, 1.0)), // 25/30
313 | NSValue(CATransform3D: CATransform3DMakeScale(0.95, 0.95, 1.0)), // 26/30
314 | NSValue(CATransform3D: CATransform3DMakeScale(0.96, 0.96, 1.0)), // 27/30
315 | NSValue(CATransform3D: CATransform3DMakeScale(0.99, 0.99, 1.0)), // 29/30
316 | NSValue(CATransform3D: CATransform3DIdentity) // 30/30
317 | ]
318 | imageTransform.keyTimes = [
319 | 0.0, // 0/30
320 | 0.1, // 3/30
321 | 0.3, // 9/30
322 | 0.333, // 10/30
323 | 0.367, // 11/30
324 | 0.467, // 14/30
325 | 0.5, // 15/30
326 | 0.533, // 16/30
327 | 0.567, // 17/30
328 | 0.667, // 20/30
329 | 0.7, // 21/30
330 | 0.733, // 22/30
331 | 0.833, // 25/30
332 | 0.867, // 26/30
333 | 0.9, // 27/30
334 | 0.967, // 29/30
335 | 1.0 // 30/30
336 | ]
337 | }
338 |
339 | private func addTargets() {
340 | //===============
341 | // add target
342 | //===============
343 | self.addTarget(self, action: "touchDown:", forControlEvents: UIControlEvents.TouchDown)
344 | self.addTarget(self, action: "touchUpInside:", forControlEvents: UIControlEvents.TouchUpInside)
345 | self.addTarget(self, action: "touchDragExit:", forControlEvents: UIControlEvents.TouchDragExit)
346 | self.addTarget(self, action: "touchDragEnter:", forControlEvents: UIControlEvents.TouchDragEnter)
347 | self.addTarget(self, action: "touchCancel:", forControlEvents: UIControlEvents.TouchCancel)
348 | }
349 |
350 | func touchDown(sender: DOFavoriteButton) {
351 | self.layer.opacity = 0.4
352 | }
353 | func touchUpInside(sender: DOFavoriteButton) {
354 | self.layer.opacity = 1.0
355 | }
356 | func touchDragExit(sender: DOFavoriteButton) {
357 | self.layer.opacity = 1.0
358 | }
359 | func touchDragEnter(sender: DOFavoriteButton) {
360 | self.layer.opacity = 0.4
361 | }
362 | func touchCancel(sender: DOFavoriteButton) {
363 | self.layer.opacity = 1.0
364 | }
365 |
366 | public func select() {
367 | select(true)
368 | }
369 |
370 | public func select(animate animate: Bool) {
371 | selected = true
372 | imageShape.fillColor = imageColorOn.CGColor
373 |
374 | if animate {
375 | CATransaction.begin()
376 |
377 | circleShape.addAnimation(circleTransform, forKey: "transform")
378 | circleMask.addAnimation(circleMaskTransform, forKey: "transform")
379 | imageShape.addAnimation(imageTransform, forKey: "transform")
380 |
381 | for i in 0 ..< 5 {
382 | lines[i].addAnimation(lineStrokeStart, forKey: "strokeStart")
383 | lines[i].addAnimation(lineStrokeEnd, forKey: "strokeEnd")
384 | lines[i].addAnimation(lineOpacity, forKey: "opacity")
385 | }
386 |
387 | CATransaction.commit()
388 | }
389 | }
390 |
391 | public func deselect() {
392 | selected = false
393 | imageShape.fillColor = imageColorOff.CGColor
394 |
395 | // remove all animations
396 | circleShape.removeAllAnimations()
397 | circleMask.removeAllAnimations()
398 | imageShape.removeAllAnimations()
399 | lines[0].removeAllAnimations()
400 | lines[1].removeAllAnimations()
401 | lines[2].removeAllAnimations()
402 | lines[3].removeAllAnimations()
403 | lines[4].removeAllAnimations()
404 | }
405 | }
406 |
--------------------------------------------------------------------------------
/DOFavoriteButton-DEMO/DOFavoriteButton-DEMO.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 4F6071201B6366ED0058F570 /* DOFavoriteButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F60711F1B6366ED0058F570 /* DOFavoriteButton.h */; settings = {ATTRIBUTES = (Public, ); }; };
11 | 4F60713C1B6367B00058F570 /* DOFavoriteButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F60713B1B6367B00058F570 /* DOFavoriteButton.swift */; };
12 | 4FBAA7031B4D807F00C8657F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FBAA7021B4D807F00C8657F /* AppDelegate.swift */; };
13 | 4FBAA7051B4D807F00C8657F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FBAA7041B4D807F00C8657F /* ViewController.swift */; };
14 | 4FBAA7081B4D807F00C8657F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4FBAA7061B4D807F00C8657F /* Main.storyboard */; };
15 | 4FBAA70A1B4D807F00C8657F /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4FBAA7091B4D807F00C8657F /* Images.xcassets */; };
16 | 4FBAA70D1B4D807F00C8657F /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4FBAA70B1B4D807F00C8657F /* LaunchScreen.xib */; };
17 | /* End PBXBuildFile section */
18 |
19 | /* Begin PBXBuildRule section */
20 | 4F60713D1B6367C90058F570 /* PBXBuildRule */ = {
21 | isa = PBXBuildRule;
22 | compilerSpec = com.apple.xcode.tools.swift.compiler;
23 | fileType = sourcecode.swift;
24 | isEditable = 1;
25 | outputFiles = (
26 | );
27 | script = "# $(SWIFT_EXEC)\n";
28 | };
29 | /* End PBXBuildRule section */
30 |
31 | /* Begin PBXFileReference section */
32 | 4F60711B1B6366ED0058F570 /* DOFavoriteButton.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DOFavoriteButton.framework; sourceTree = BUILT_PRODUCTS_DIR; };
33 | 4F60711E1B6366ED0058F570 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
34 | 4F60711F1B6366ED0058F570 /* DOFavoriteButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DOFavoriteButton.h; sourceTree = ""; };
35 | 4F60713B1B6367B00058F570 /* DOFavoriteButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DOFavoriteButton.swift; path = ../../DOFavoriteButton/DOFavoriteButton.swift; sourceTree = ""; };
36 | 4FBAA6FD1B4D807F00C8657F /* DOFavoriteButton-DEMO.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DOFavoriteButton-DEMO.app"; sourceTree = BUILT_PRODUCTS_DIR; };
37 | 4FBAA7011B4D807F00C8657F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
38 | 4FBAA7021B4D807F00C8657F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
39 | 4FBAA7041B4D807F00C8657F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
40 | 4FBAA7071B4D807F00C8657F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
41 | 4FBAA7091B4D807F00C8657F /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
42 | 4FBAA70C1B4D807F00C8657F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; };
43 | /* End PBXFileReference section */
44 |
45 | /* Begin PBXFrameworksBuildPhase section */
46 | 4F6071171B6366ED0058F570 /* Frameworks */ = {
47 | isa = PBXFrameworksBuildPhase;
48 | buildActionMask = 2147483647;
49 | files = (
50 | );
51 | runOnlyForDeploymentPostprocessing = 0;
52 | };
53 | 4FBAA6FA1B4D807F00C8657F /* Frameworks */ = {
54 | isa = PBXFrameworksBuildPhase;
55 | buildActionMask = 2147483647;
56 | files = (
57 | );
58 | runOnlyForDeploymentPostprocessing = 0;
59 | };
60 | /* End PBXFrameworksBuildPhase section */
61 |
62 | /* Begin PBXGroup section */
63 | 4F60711C1B6366ED0058F570 /* DOFavoriteButton */ = {
64 | isa = PBXGroup;
65 | children = (
66 | 4F60713B1B6367B00058F570 /* DOFavoriteButton.swift */,
67 | 4F60711F1B6366ED0058F570 /* DOFavoriteButton.h */,
68 | 4F60711D1B6366ED0058F570 /* Supporting Files */,
69 | );
70 | path = DOFavoriteButton;
71 | sourceTree = "";
72 | };
73 | 4F60711D1B6366ED0058F570 /* Supporting Files */ = {
74 | isa = PBXGroup;
75 | children = (
76 | 4F60711E1B6366ED0058F570 /* Info.plist */,
77 | );
78 | name = "Supporting Files";
79 | sourceTree = "";
80 | };
81 | 4FBAA6F41B4D807F00C8657F = {
82 | isa = PBXGroup;
83 | children = (
84 | 4FBAA6FF1B4D807F00C8657F /* DOFavoriteButton-DEMO */,
85 | 4F60711C1B6366ED0058F570 /* DOFavoriteButton */,
86 | 4FBAA6FE1B4D807F00C8657F /* Products */,
87 | );
88 | sourceTree = "";
89 | };
90 | 4FBAA6FE1B4D807F00C8657F /* Products */ = {
91 | isa = PBXGroup;
92 | children = (
93 | 4FBAA6FD1B4D807F00C8657F /* DOFavoriteButton-DEMO.app */,
94 | 4F60711B1B6366ED0058F570 /* DOFavoriteButton.framework */,
95 | );
96 | name = Products;
97 | sourceTree = "";
98 | };
99 | 4FBAA6FF1B4D807F00C8657F /* DOFavoriteButton-DEMO */ = {
100 | isa = PBXGroup;
101 | children = (
102 | 4FBAA7021B4D807F00C8657F /* AppDelegate.swift */,
103 | 4FBAA7041B4D807F00C8657F /* ViewController.swift */,
104 | 4FBAA7061B4D807F00C8657F /* Main.storyboard */,
105 | 4FBAA7091B4D807F00C8657F /* Images.xcassets */,
106 | 4FBAA70B1B4D807F00C8657F /* LaunchScreen.xib */,
107 | 4FBAA7001B4D807F00C8657F /* Supporting Files */,
108 | );
109 | path = "DOFavoriteButton-DEMO";
110 | sourceTree = "";
111 | };
112 | 4FBAA7001B4D807F00C8657F /* Supporting Files */ = {
113 | isa = PBXGroup;
114 | children = (
115 | 4FBAA7011B4D807F00C8657F /* Info.plist */,
116 | );
117 | name = "Supporting Files";
118 | sourceTree = "";
119 | };
120 | /* End PBXGroup section */
121 |
122 | /* Begin PBXHeadersBuildPhase section */
123 | 4F6071181B6366ED0058F570 /* Headers */ = {
124 | isa = PBXHeadersBuildPhase;
125 | buildActionMask = 2147483647;
126 | files = (
127 | 4F6071201B6366ED0058F570 /* DOFavoriteButton.h in Headers */,
128 | );
129 | runOnlyForDeploymentPostprocessing = 0;
130 | };
131 | /* End PBXHeadersBuildPhase section */
132 |
133 | /* Begin PBXNativeTarget section */
134 | 4F60711A1B6366ED0058F570 /* DOFavoriteButton */ = {
135 | isa = PBXNativeTarget;
136 | buildConfigurationList = 4F6071341B6366ED0058F570 /* Build configuration list for PBXNativeTarget "DOFavoriteButton" */;
137 | buildPhases = (
138 | 4F6071161B6366ED0058F570 /* Sources */,
139 | 4F6071171B6366ED0058F570 /* Frameworks */,
140 | 4F6071181B6366ED0058F570 /* Headers */,
141 | 4F6071191B6366ED0058F570 /* Resources */,
142 | );
143 | buildRules = (
144 | 4F60713D1B6367C90058F570 /* PBXBuildRule */,
145 | );
146 | dependencies = (
147 | );
148 | name = DOFavoriteButton;
149 | productName = DOFavoriteButton;
150 | productReference = 4F60711B1B6366ED0058F570 /* DOFavoriteButton.framework */;
151 | productType = "com.apple.product-type.framework";
152 | };
153 | 4FBAA6FC1B4D807F00C8657F /* DOFavoriteButton-DEMO */ = {
154 | isa = PBXNativeTarget;
155 | buildConfigurationList = 4FBAA71C1B4D807F00C8657F /* Build configuration list for PBXNativeTarget "DOFavoriteButton-DEMO" */;
156 | buildPhases = (
157 | 4FBAA6F91B4D807F00C8657F /* Sources */,
158 | 4FBAA6FA1B4D807F00C8657F /* Frameworks */,
159 | 4FBAA6FB1B4D807F00C8657F /* Resources */,
160 | );
161 | buildRules = (
162 | );
163 | dependencies = (
164 | );
165 | name = "DOFavoriteButton-DEMO";
166 | productName = "DOFavoriteButton-DEMO";
167 | productReference = 4FBAA6FD1B4D807F00C8657F /* DOFavoriteButton-DEMO.app */;
168 | productType = "com.apple.product-type.application";
169 | };
170 | /* End PBXNativeTarget section */
171 |
172 | /* Begin PBXProject section */
173 | 4FBAA6F51B4D807F00C8657F /* Project object */ = {
174 | isa = PBXProject;
175 | attributes = {
176 | LastSwiftMigration = 0700;
177 | LastSwiftUpdateCheck = 0700;
178 | LastUpgradeCheck = 0700;
179 | ORGANIZATIONNAME = "Daiki Okumura";
180 | TargetAttributes = {
181 | 4F60711A1B6366ED0058F570 = {
182 | CreatedOnToolsVersion = 6.4;
183 | };
184 | 4FBAA6FC1B4D807F00C8657F = {
185 | CreatedOnToolsVersion = 6.4;
186 | };
187 | };
188 | };
189 | buildConfigurationList = 4FBAA6F81B4D807F00C8657F /* Build configuration list for PBXProject "DOFavoriteButton-DEMO" */;
190 | compatibilityVersion = "Xcode 3.2";
191 | developmentRegion = English;
192 | hasScannedForEncodings = 0;
193 | knownRegions = (
194 | en,
195 | Base,
196 | );
197 | mainGroup = 4FBAA6F41B4D807F00C8657F;
198 | productRefGroup = 4FBAA6FE1B4D807F00C8657F /* Products */;
199 | projectDirPath = "";
200 | projectRoot = "";
201 | targets = (
202 | 4FBAA6FC1B4D807F00C8657F /* DOFavoriteButton-DEMO */,
203 | 4F60711A1B6366ED0058F570 /* DOFavoriteButton */,
204 | );
205 | };
206 | /* End PBXProject section */
207 |
208 | /* Begin PBXResourcesBuildPhase section */
209 | 4F6071191B6366ED0058F570 /* Resources */ = {
210 | isa = PBXResourcesBuildPhase;
211 | buildActionMask = 2147483647;
212 | files = (
213 | );
214 | runOnlyForDeploymentPostprocessing = 0;
215 | };
216 | 4FBAA6FB1B4D807F00C8657F /* Resources */ = {
217 | isa = PBXResourcesBuildPhase;
218 | buildActionMask = 2147483647;
219 | files = (
220 | 4FBAA7081B4D807F00C8657F /* Main.storyboard in Resources */,
221 | 4FBAA70D1B4D807F00C8657F /* LaunchScreen.xib in Resources */,
222 | 4FBAA70A1B4D807F00C8657F /* Images.xcassets in Resources */,
223 | );
224 | runOnlyForDeploymentPostprocessing = 0;
225 | };
226 | /* End PBXResourcesBuildPhase section */
227 |
228 | /* Begin PBXSourcesBuildPhase section */
229 | 4F6071161B6366ED0058F570 /* Sources */ = {
230 | isa = PBXSourcesBuildPhase;
231 | buildActionMask = 2147483647;
232 | files = (
233 | 4F60713C1B6367B00058F570 /* DOFavoriteButton.swift in Sources */,
234 | );
235 | runOnlyForDeploymentPostprocessing = 0;
236 | };
237 | 4FBAA6F91B4D807F00C8657F /* Sources */ = {
238 | isa = PBXSourcesBuildPhase;
239 | buildActionMask = 2147483647;
240 | files = (
241 | 4FBAA7051B4D807F00C8657F /* ViewController.swift in Sources */,
242 | 4FBAA7031B4D807F00C8657F /* AppDelegate.swift in Sources */,
243 | );
244 | runOnlyForDeploymentPostprocessing = 0;
245 | };
246 | /* End PBXSourcesBuildPhase section */
247 |
248 | /* Begin PBXVariantGroup section */
249 | 4FBAA7061B4D807F00C8657F /* Main.storyboard */ = {
250 | isa = PBXVariantGroup;
251 | children = (
252 | 4FBAA7071B4D807F00C8657F /* Base */,
253 | );
254 | name = Main.storyboard;
255 | sourceTree = "";
256 | };
257 | 4FBAA70B1B4D807F00C8657F /* LaunchScreen.xib */ = {
258 | isa = PBXVariantGroup;
259 | children = (
260 | 4FBAA70C1B4D807F00C8657F /* Base */,
261 | );
262 | name = LaunchScreen.xib;
263 | sourceTree = "";
264 | };
265 | /* End PBXVariantGroup section */
266 |
267 | /* Begin XCBuildConfiguration section */
268 | 4F6071351B6366ED0058F570 /* Debug */ = {
269 | isa = XCBuildConfiguration;
270 | buildSettings = {
271 | CLANG_ENABLE_MODULES = YES;
272 | CURRENT_PROJECT_VERSION = 1;
273 | DEFINES_MODULE = YES;
274 | DYLIB_COMPATIBILITY_VERSION = 1;
275 | DYLIB_CURRENT_VERSION = 1;
276 | DYLIB_INSTALL_NAME_BASE = "@rpath";
277 | GCC_PREPROCESSOR_DEFINITIONS = (
278 | "DEBUG=1",
279 | "$(inherited)",
280 | );
281 | INFOPLIST_FILE = DOFavoriteButton/Info.plist;
282 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
283 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
284 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
285 | PRODUCT_BUNDLE_IDENTIFIER = "co.devlog.$(PRODUCT_NAME:rfc1034identifier)";
286 | PRODUCT_NAME = "$(TARGET_NAME)";
287 | SKIP_INSTALL = YES;
288 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
289 | VERSIONING_SYSTEM = "apple-generic";
290 | VERSION_INFO_PREFIX = "";
291 | };
292 | name = Debug;
293 | };
294 | 4F6071361B6366ED0058F570 /* Release */ = {
295 | isa = XCBuildConfiguration;
296 | buildSettings = {
297 | CLANG_ENABLE_MODULES = YES;
298 | CURRENT_PROJECT_VERSION = 1;
299 | DEFINES_MODULE = YES;
300 | DYLIB_COMPATIBILITY_VERSION = 1;
301 | DYLIB_CURRENT_VERSION = 1;
302 | DYLIB_INSTALL_NAME_BASE = "@rpath";
303 | INFOPLIST_FILE = DOFavoriteButton/Info.plist;
304 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
305 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
306 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
307 | PRODUCT_BUNDLE_IDENTIFIER = "co.devlog.$(PRODUCT_NAME:rfc1034identifier)";
308 | PRODUCT_NAME = "$(TARGET_NAME)";
309 | SKIP_INSTALL = YES;
310 | VERSIONING_SYSTEM = "apple-generic";
311 | VERSION_INFO_PREFIX = "";
312 | };
313 | name = Release;
314 | };
315 | 4FBAA71A1B4D807F00C8657F /* Debug */ = {
316 | isa = XCBuildConfiguration;
317 | buildSettings = {
318 | ALWAYS_SEARCH_USER_PATHS = NO;
319 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
320 | CLANG_CXX_LIBRARY = "libc++";
321 | CLANG_ENABLE_MODULES = YES;
322 | CLANG_ENABLE_OBJC_ARC = YES;
323 | CLANG_WARN_BOOL_CONVERSION = YES;
324 | CLANG_WARN_CONSTANT_CONVERSION = YES;
325 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
326 | CLANG_WARN_EMPTY_BODY = YES;
327 | CLANG_WARN_ENUM_CONVERSION = YES;
328 | CLANG_WARN_INT_CONVERSION = YES;
329 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
330 | CLANG_WARN_UNREACHABLE_CODE = YES;
331 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
332 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
333 | COPY_PHASE_STRIP = NO;
334 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
335 | ENABLE_STRICT_OBJC_MSGSEND = YES;
336 | ENABLE_TESTABILITY = YES;
337 | GCC_C_LANGUAGE_STANDARD = gnu99;
338 | GCC_DYNAMIC_NO_PIC = NO;
339 | GCC_NO_COMMON_BLOCKS = YES;
340 | GCC_OPTIMIZATION_LEVEL = 0;
341 | GCC_PREPROCESSOR_DEFINITIONS = (
342 | "DEBUG=1",
343 | "$(inherited)",
344 | );
345 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
346 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
347 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
348 | GCC_WARN_UNDECLARED_SELECTOR = YES;
349 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
350 | GCC_WARN_UNUSED_FUNCTION = YES;
351 | GCC_WARN_UNUSED_VARIABLE = YES;
352 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
353 | MTL_ENABLE_DEBUG_INFO = YES;
354 | ONLY_ACTIVE_ARCH = YES;
355 | SDKROOT = iphoneos;
356 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
357 | TARGETED_DEVICE_FAMILY = "1,2";
358 | };
359 | name = Debug;
360 | };
361 | 4FBAA71B1B4D807F00C8657F /* Release */ = {
362 | isa = XCBuildConfiguration;
363 | buildSettings = {
364 | ALWAYS_SEARCH_USER_PATHS = NO;
365 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
366 | CLANG_CXX_LIBRARY = "libc++";
367 | CLANG_ENABLE_MODULES = YES;
368 | CLANG_ENABLE_OBJC_ARC = YES;
369 | CLANG_WARN_BOOL_CONVERSION = YES;
370 | CLANG_WARN_CONSTANT_CONVERSION = YES;
371 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
372 | CLANG_WARN_EMPTY_BODY = YES;
373 | CLANG_WARN_ENUM_CONVERSION = YES;
374 | CLANG_WARN_INT_CONVERSION = YES;
375 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
376 | CLANG_WARN_UNREACHABLE_CODE = YES;
377 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
378 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
379 | COPY_PHASE_STRIP = NO;
380 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
381 | ENABLE_NS_ASSERTIONS = NO;
382 | ENABLE_STRICT_OBJC_MSGSEND = YES;
383 | GCC_C_LANGUAGE_STANDARD = gnu99;
384 | GCC_NO_COMMON_BLOCKS = YES;
385 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
386 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
387 | GCC_WARN_UNDECLARED_SELECTOR = YES;
388 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
389 | GCC_WARN_UNUSED_FUNCTION = YES;
390 | GCC_WARN_UNUSED_VARIABLE = YES;
391 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
392 | MTL_ENABLE_DEBUG_INFO = NO;
393 | SDKROOT = iphoneos;
394 | TARGETED_DEVICE_FAMILY = "1,2";
395 | VALIDATE_PRODUCT = YES;
396 | };
397 | name = Release;
398 | };
399 | 4FBAA71D1B4D807F00C8657F /* Debug */ = {
400 | isa = XCBuildConfiguration;
401 | buildSettings = {
402 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
403 | INFOPLIST_FILE = "DOFavoriteButton-DEMO/Info.plist";
404 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
405 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
406 | PRODUCT_BUNDLE_IDENTIFIER = "co.devlog.$(PRODUCT_NAME:rfc1034identifier)";
407 | PRODUCT_NAME = "$(TARGET_NAME)";
408 | };
409 | name = Debug;
410 | };
411 | 4FBAA71E1B4D807F00C8657F /* Release */ = {
412 | isa = XCBuildConfiguration;
413 | buildSettings = {
414 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
415 | INFOPLIST_FILE = "DOFavoriteButton-DEMO/Info.plist";
416 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
417 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
418 | PRODUCT_BUNDLE_IDENTIFIER = "co.devlog.$(PRODUCT_NAME:rfc1034identifier)";
419 | PRODUCT_NAME = "$(TARGET_NAME)";
420 | };
421 | name = Release;
422 | };
423 | /* End XCBuildConfiguration section */
424 |
425 | /* Begin XCConfigurationList section */
426 | 4F6071341B6366ED0058F570 /* Build configuration list for PBXNativeTarget "DOFavoriteButton" */ = {
427 | isa = XCConfigurationList;
428 | buildConfigurations = (
429 | 4F6071351B6366ED0058F570 /* Debug */,
430 | 4F6071361B6366ED0058F570 /* Release */,
431 | );
432 | defaultConfigurationIsVisible = 0;
433 | defaultConfigurationName = Release;
434 | };
435 | 4FBAA6F81B4D807F00C8657F /* Build configuration list for PBXProject "DOFavoriteButton-DEMO" */ = {
436 | isa = XCConfigurationList;
437 | buildConfigurations = (
438 | 4FBAA71A1B4D807F00C8657F /* Debug */,
439 | 4FBAA71B1B4D807F00C8657F /* Release */,
440 | );
441 | defaultConfigurationIsVisible = 0;
442 | defaultConfigurationName = Release;
443 | };
444 | 4FBAA71C1B4D807F00C8657F /* Build configuration list for PBXNativeTarget "DOFavoriteButton-DEMO" */ = {
445 | isa = XCConfigurationList;
446 | buildConfigurations = (
447 | 4FBAA71D1B4D807F00C8657F /* Debug */,
448 | 4FBAA71E1B4D807F00C8657F /* Release */,
449 | );
450 | defaultConfigurationIsVisible = 0;
451 | defaultConfigurationName = Release;
452 | };
453 | /* End XCConfigurationList section */
454 | };
455 | rootObject = 4FBAA6F51B4D807F00C8657F /* Project object */;
456 | }
457 |
--------------------------------------------------------------------------------