Skip to content

Commit 1cb507a

Browse files
committed
Initial commit
Add RECButton Add demo Add readme Add podspec
1 parent ba87ccc commit 1cb507a

File tree

12 files changed

+441
-81
lines changed

12 files changed

+441
-81
lines changed

.gitignore

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
2+
# Created by https://www.gitignore.io/api/swift,xcode
3+
4+
### Swift ###
5+
# Xcode
6+
#
7+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
8+
9+
## Build generated
10+
build/
11+
DerivedData/
12+
13+
## Various settings
14+
*.pbxuser
15+
!default.pbxuser
16+
*.mode1v3
17+
!default.mode1v3
18+
*.mode2v3
19+
!default.mode2v3
20+
*.perspectivev3
21+
!default.perspectivev3
22+
xcuserdata/
23+
24+
## Other
25+
*.moved-aside
26+
*.xcuserstate
27+
28+
## Obj-C/Swift specific
29+
*.hmap
30+
*.ipa
31+
*.dSYM.zip
32+
*.dSYM
33+
34+
## Playgrounds
35+
timeline.xctimeline
36+
playground.xcworkspace
37+
38+
# Swift Package Manager
39+
#
40+
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
41+
# Packages/
42+
.build/
43+
44+
# CocoaPods
45+
#
46+
# We recommend against adding the Pods directory to your .gitignore. However
47+
# you should judge for yourself, the pros and cons are mentioned at:
48+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
49+
#
50+
Pods/
51+
52+
# Carthage
53+
#
54+
# Add this line if you want to avoid checking in source code from Carthage dependencies.
55+
Carthage/Checkouts
56+
57+
Carthage/Build
58+
59+
# fastlane
60+
#
61+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
62+
# screenshots whenever they are needed.
63+
# For more information about the recommended setup visit:
64+
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
65+
66+
fastlane/report.xml
67+
fastlane/Preview.html
68+
fastlane/screenshots
69+
fastlane/test_output
70+
builds/
71+
72+
### Xcode ###
73+
# Xcode
74+
#
75+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
76+
77+
## Build generated
78+
79+
## Various settings
80+
81+
## Other
82+
*.xccheckout
83+
*.xcscmblueprint
84+
85+
# Docs
86+
docs/
87+
.public/
88+
public/
89+
.DS_Store
90+
91+
# End of https://www.gitignore.io/api/swift,xcode

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (C) 2020, Cem Olcay
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a
4+
copy of this software and associated documentation files (the "Software"),
5+
to deal in the Software without restriction, including without limitation
6+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
7+
and/or sell copies of the Software, and to permit persons to whom the
8+
Software is furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19+
DEALINGS IN THE SOFTWARE.
20+

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
RECButton
2+
===
3+
4+
An @IBInspectable record (REC) button for iOS.
5+
6+
Usage
7+
----
8+
9+
![alt tag](https://raw.githubusercontent.com/cemolcay/RECButton/master/sb.gif)
10+
11+
* RECButton is a UIButton subclass
12+
* Create a RECButton instance either from storyboard or programmatically.
13+
* Set the color and size properties for recording state and non-recording state.
14+
* Those are also IBInspectable, settable directly from the storyboard.
15+
* Set other inherited UIButton properties.
16+
17+
``` swift
18+
@IBInspectable public var ringColor: UIColor = .white
19+
@IBInspectable public var dotColor: UIColor = .white
20+
@IBInspectable public var recordingDotColor: UIColor = .red
21+
@IBInspectable public var recordingRingColor: UIColor = .orange
22+
@IBInspectable public var dotPadding: CGFloat = 2
23+
@IBInspectable public var ringLineWidth: CGFloat = 1
24+
@IBInspectable public var recordingRingDashPattern: String?
25+
@IBInspectable public var recordingAnimationDuration: CGFloat = 0
26+
@IBInspectable public var isRecording: Bool = false
27+
```
28+
29+
Recording
30+
----
31+
32+
* Set `isRecording` bool value.
33+
34+
![alt tag](https://raw.githubusercontent.com/cemolcay/RECButton/master/rec.gif)

RECButton.podspec

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
#
2+
# Be sure to run `pod spec lint RECButton.podspec' to ensure this is a
3+
# valid spec and to remove all comments including this before submitting the spec.
4+
#
5+
# To learn more about Podspec attributes see https://guides.cocoapods.org/syntax/podspec.html
6+
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
7+
#
8+
9+
Pod::Spec.new do |spec|
10+
11+
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
12+
#
13+
# These will help people to find your library, and whilst it
14+
# can feel like a chore to fill in it's definitely to your advantage. The
15+
# summary should be tweet-length, and the description more in depth.
16+
#
17+
18+
spec.name = "RECButton"
19+
spec.version = "0.0.1"
20+
spec.summary = "An @IBInspectable record (REC) button for iOS"
21+
22+
# This description is used to generate tags and improve search results.
23+
# * Think: What does it do? Why did you write it? What is the focus?
24+
# * Try to keep it short, snappy and to the point.
25+
# * Write the description between the DESC delimiters below.
26+
# * Finally, don't worry about the indent, CocoaPods strips it!
27+
spec.description = <<-DESC
28+
An @IBInspectable record (REC) button for iOS.
29+
DESC
30+
31+
spec.homepage = "http://EXAMPLE/RECButton"
32+
# spec.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"
33+
34+
35+
# ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
36+
#
37+
# Licensing your code is important. See https://choosealicense.com for more info.
38+
# CocoaPods will detect a license file if there is a named LICENSE*
39+
# Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
40+
#
41+
42+
spec.license = "MIT"
43+
# spec.license = { :type => "MIT", :file => "FILE_LICENSE" }
44+
45+
46+
# ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
47+
#
48+
# Specify the authors of the library, with email addresses. Email addresses
49+
# of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
50+
# accepts just a name if you'd rather not provide an email address.
51+
#
52+
# Specify a social_media_url where others can refer to, for example a twitter
53+
# profile URL.
54+
#
55+
56+
spec.author = { "cemolcay" => "[email protected]" }
57+
# Or just: spec.author = "Cem Olcay"
58+
# spec.authors = { "Cem Olcay" => "[email protected]" }
59+
spec.social_media_url = "https://twitter.com/cem_olcay"
60+
61+
# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
62+
#
63+
# If this Pod runs only on iOS or OS X, then specify the platform and
64+
# the deployment target. You can optionally include the target after the platform.
65+
#
66+
67+
# spec.platform = :ios
68+
spec.platform = :ios, "9.0"
69+
70+
# When using multiple platforms
71+
# spec.ios.deployment_target = "5.0"
72+
# spec.osx.deployment_target = "10.7"
73+
# spec.watchos.deployment_target = "2.0"
74+
# spec.tvos.deployment_target = "9.0"
75+
76+
77+
# ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
78+
#
79+
# Specify the location from where the source should be retrieved.
80+
# Supports git, hg, bzr, svn and HTTP.
81+
#
82+
83+
spec.source = { :git => "https://github.com/cemolcay/RECButton.git", :tag => "#{spec.version}" }
84+
85+
86+
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
87+
#
88+
# CocoaPods is smart about how it includes source code. For source files
89+
# giving a folder will include any swift, h, m, mm, c & cpp files.
90+
# For header files it will include any header in the folder.
91+
# Not including the public_header_files will make all headers public.
92+
#
93+
94+
spec.source_files = "RECButton/RECButton.swift"
95+
# spec.exclude_files = "Classes/Exclude"
96+
97+
# spec.public_header_files = "Classes/**/*.h"
98+
99+
100+
# ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
101+
#
102+
# A list of resources included with the Pod. These are copied into the
103+
# target bundle with a build phase script. Anything else will be cleaned.
104+
# You can preserve files from being cleaned, please don't preserve
105+
# non-essential files like tests, examples and documentation.
106+
#
107+
108+
# spec.resource = "icon.png"
109+
# spec.resources = "Resources/*.png"
110+
111+
# spec.preserve_paths = "FilesToSave", "MoreFilesToSave"
112+
113+
114+
# ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
115+
#
116+
# Link your library with frameworks, or libraries. Libraries do not include
117+
# the lib prefix of their name.
118+
#
119+
120+
# spec.framework = "SomeFramework"
121+
# spec.frameworks = "SomeFramework", "AnotherFramework"
122+
123+
# spec.library = "iconv"
124+
# spec.libraries = "iconv", "xml2"
125+
126+
127+
# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
128+
#
129+
# If your library depends on compiler flags you can set them in the xcconfig hash
130+
# where they will only apply to your library. If you depend on other Podspecs
131+
# you can include multiple dependencies to ensure it works.
132+
133+
spec.requires_arc = true
134+
135+
# spec.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
136+
# spec.dependency "JSONKit", "~> 1.4"
137+
138+
end

RECButton.xcodeproj/project.pbxproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@
88

99
/* Begin PBXBuildFile section */
1010
534DE99023C313E20044835F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 534DE98F23C313E20044835F /* AppDelegate.swift */; };
11-
534DE99223C313E20044835F /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 534DE99123C313E20044835F /* SceneDelegate.swift */; };
1211
534DE99423C313E20044835F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 534DE99323C313E20044835F /* ViewController.swift */; };
1312
534DE99723C313E20044835F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 534DE99523C313E20044835F /* Main.storyboard */; };
1413
534DE99923C313E40044835F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 534DE99823C313E40044835F /* Assets.xcassets */; };
1514
534DE99C23C313E40044835F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 534DE99A23C313E40044835F /* LaunchScreen.storyboard */; };
15+
534DE9A423C314290044835F /* RECButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 534DE9A323C314290044835F /* RECButton.swift */; };
1616
/* End PBXBuildFile section */
1717

1818
/* Begin PBXFileReference section */
1919
534DE98C23C313E20044835F /* RECButton.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RECButton.app; sourceTree = BUILT_PRODUCTS_DIR; };
2020
534DE98F23C313E20044835F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
21-
534DE99123C313E20044835F /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
2221
534DE99323C313E20044835F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
2322
534DE99623C313E20044835F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
2423
534DE99823C313E40044835F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
2524
534DE99B23C313E40044835F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
2625
534DE99D23C313E40044835F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
26+
534DE9A323C314290044835F /* RECButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RECButton.swift; sourceTree = "<group>"; };
2727
/* End PBXFileReference section */
2828

2929
/* Begin PBXFrameworksBuildPhase section */
@@ -57,8 +57,8 @@
5757
isa = PBXGroup;
5858
children = (
5959
534DE98F23C313E20044835F /* AppDelegate.swift */,
60-
534DE99123C313E20044835F /* SceneDelegate.swift */,
6160
534DE99323C313E20044835F /* ViewController.swift */,
61+
534DE9A323C314290044835F /* RECButton.swift */,
6262
534DE99523C313E20044835F /* Main.storyboard */,
6363
534DE99823C313E40044835F /* Assets.xcassets */,
6464
534DE99A23C313E40044835F /* LaunchScreen.storyboard */,
@@ -138,9 +138,9 @@
138138
isa = PBXSourcesBuildPhase;
139139
buildActionMask = 2147483647;
140140
files = (
141+
534DE9A423C314290044835F /* RECButton.swift in Sources */,
141142
534DE99423C313E20044835F /* ViewController.swift in Sources */,
142143
534DE99023C313E20044835F /* AppDelegate.swift in Sources */,
143-
534DE99223C313E20044835F /* SceneDelegate.swift in Sources */,
144144
);
145145
runOnlyForDeploymentPostprocessing = 0;
146146
};
@@ -287,6 +287,7 @@
287287
CODE_SIGN_STYLE = Automatic;
288288
DEVELOPMENT_TEAM = 77Y3N48SNF;
289289
INFOPLIST_FILE = RECButton/Info.plist;
290+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
290291
LD_RUNPATH_SEARCH_PATHS = (
291292
"$(inherited)",
292293
"@executable_path/Frameworks",
@@ -305,6 +306,7 @@
305306
CODE_SIGN_STYLE = Automatic;
306307
DEVELOPMENT_TEAM = 77Y3N48SNF;
307308
INFOPLIST_FILE = RECButton/Info.plist;
309+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
308310
LD_RUNPATH_SEARCH_PATHS = (
309311
"$(inherited)",
310312
"@executable_path/Frameworks",

RECButton/AppDelegate.swift

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,5 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1717
// Override point for customization after application launch.
1818
return true
1919
}
20-
21-
// MARK: UISceneSession Lifecycle
22-
23-
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
24-
// Called when a new scene session is being created.
25-
// Use this method to select a configuration to create the new scene with.
26-
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
27-
}
28-
29-
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
30-
// Called when the user discards a scene session.
31-
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
32-
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
33-
}
34-
35-
3620
}
3721

0 commit comments

Comments
 (0)