Skip to content

Commit

Permalink
Change access modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
jogendra committed Jun 13, 2019
1 parent 461f9ca commit 509e162
Show file tree
Hide file tree
Showing 10 changed files with 186 additions and 185 deletions.
6 changes: 1 addition & 5 deletions Example/BadgeHub.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = "<group>"; };
6BA978FDD0134429CACE8071 /* Pods-BadgeHub_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BadgeHub_Example.debug.xcconfig"; path = "Target Support Files/Pods-BadgeHub_Example/Pods-BadgeHub_Example.debug.xcconfig"; sourceTree = "<group>"; };
8C6093D0F2D2C1CC2CAC3CF8 /* BadgeHub.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = BadgeHub.podspec; path = ../BadgeHub.podspec; sourceTree = "<group>"; };
8C6093D0F2D2C1CC2CAC3CF8 /* BadgeHub.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = BadgeHub.podspec; path = ../BadgeHub.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
989B2D641A9A7D73E7AD6F13 /* Pods-BadgeHub_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BadgeHub_Tests.release.xcconfig"; path = "Target Support Files/Pods-BadgeHub_Tests/Pods-BadgeHub_Tests.release.xcconfig"; sourceTree = "<group>"; };
B4B146157EB2EAC3AB61F5D9 /* Pods-BadgeHub_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BadgeHub_Example.release.xcconfig"; path = "Target Support Files/Pods-BadgeHub_Example/Pods-BadgeHub_Example.release.xcconfig"; sourceTree = "<group>"; };
C2E79FE58B30BFE220846F82 /* Pods_BadgeHub_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_BadgeHub_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -321,15 +321,11 @@
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-BadgeHub_Example/Pods-BadgeHub_Example-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/BadgeHub/BadgeHub.framework",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
);
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/BadgeHub.framework",
);
Expand Down
46 changes: 22 additions & 24 deletions Example/BadgeHub/BadgeHub.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class BadgeHub: NSObject {
private var isIndeterminateMode = false

// MARK: - SETUP
init(view: UIView) {
public init(view: UIView) {
super.init()

maxCount = 100000
Expand All @@ -76,7 +76,7 @@ public class BadgeHub: NSObject {
// }

// Adjustment methods
func setView(_ view: UIView?, andCount startCount: Int) {
public func setView(_ view: UIView?, andCount startCount: Int) {
curOrderMagnitude = 0

let frame: CGRect? = view?.frame
Expand Down Expand Up @@ -106,7 +106,7 @@ public class BadgeHub: NSObject {
}

// Set the frame of the notification circle relative to the button
func setCircleAtFrame(_ frame: CGRect) {
public func setCircleAtFrame(_ frame: CGRect) {
redCircle.frame = frame
initialCenter = CGPoint(x: frame.origin.x + frame.size.width / 2, y: frame.origin.y + frame.size.height / 2)
baseFrame = frame
Expand All @@ -118,29 +118,28 @@ public class BadgeHub: NSObject {
}

// Change the color of the notification circle
func setCircleColor(_ circleColor: UIColor?, label labelColor: UIColor?) {
public func setCircleColor(_ circleColor: UIColor?, label labelColor: UIColor?) {
redCircle.isUserChangingBackgroundColor = true
redCircle.backgroundColor = circleColor
if let labelColor = labelColor {
countLabel?.textColor = labelColor
}
}

func setCircleBorderColor(_ color: UIColor?, borderWidth width: CGFloat) {
public func setCircleBorderColor(_ color: UIColor?, borderWidth width: CGFloat) {
redCircle.layer.borderColor = color?.cgColor
redCircle.layer.borderWidth = width
}


func moveCircleBy(x: CGFloat, y: CGFloat) {
public func moveCircleBy(x: CGFloat, y: CGFloat) {
var frame: CGRect = redCircle.frame
frame.origin.x += x
frame.origin.y += y
self.setCircleAtFrame(frame)
}

// Changes the size of the circle. setting a scale of 1 has no effect
func scaleCircleSize(by scale: CGFloat) {
public func scaleCircleSize(by scale: CGFloat) {
let fr: CGRect = initialFrame
let width: CGFloat = fr.size.width * scale
let height: CGFloat = fr.size.height * scale
Expand All @@ -152,41 +151,41 @@ public class BadgeHub: NSObject {
}

// Increases count by 1
func increment() {
public func increment() {
increment(by: 1)
}

// Increases count by amount
func increment(by amount: Int) {
public func increment(by amount: Int) {
count += amount
}

// Decreases count
func decrement() {
public func decrement() {
decrement(by: 1)
}

// Decreases count by amount
func decrement(by amount: Int) {
public func decrement(by amount: Int) {
if amount >= count {
count = 0
return
}
count -= amount
}

func hideCount() {
public func hideCount() {
countLabel?.isHidden = true
isIndeterminateMode = true
}

func showCount() {
public func showCount() {
isIndeterminateMode = false
checkZero()
}

// Animations
func pop() {
public func pop() {
let height = baseFrame.size.height
let width = baseFrame.size.width
let popStartHeight: Float = Float(height * popStartRatio)
Expand Down Expand Up @@ -273,7 +272,7 @@ public class BadgeHub: NSObject {
}
}

func blink() {
public func blink() {
self.setAlpha(alpha: Float(blinkAlpha))

UIView.animate(withDuration: TimeInterval(blinkDuration), animations: {
Expand All @@ -290,7 +289,7 @@ public class BadgeHub: NSObject {
}

// Animation that jumps similar to OSX dock icons
func bump() {
public func bump() {
if !initialCenter.equalTo(redCircle.center) {
// canel previous animation
}
Expand All @@ -313,9 +312,8 @@ public class BadgeHub: NSObject {
}
}


// Set the count yourself
func setCount(_ newCount: Int) {
public func setCount(_ newCount: Int) {
count = newCount

var labelText = "\(NSNumber(value: count))"
Expand All @@ -330,28 +328,28 @@ public class BadgeHub: NSObject {
}

// Set the font of the label
func setCountLabel(_ font: UIFont?) {
public func setCountLabel(_ font: UIFont?) {
countLabel?.font = font
}

func countLabelFont() -> UIFont? {
public func countLabelFont() -> UIFont? {
return countLabel?.font
}


func bumpCenterY(yVal: Float) {
public func bumpCenterY(yVal: Float) {
var center: CGPoint = redCircle.center
center.y = initialCenter.y - CGFloat(yVal)
redCircle.center = center
countLabel?.center = center
}

func setAlpha(alpha: Float) {
public func setAlpha(alpha: Float) {
redCircle.alpha = CGFloat(alpha)
countLabel?.alpha = CGFloat(alpha)
}

func checkZero() {
public func checkZero() {
if count <= 0 {
redCircle.isHidden = true
countLabel?.isHidden = true
Expand Down
6 changes: 3 additions & 3 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- BadgeHub (0.1.0)
- BadgeHub (0.1.1)

DEPENDENCIES:
- BadgeHub (from `../`)
Expand All @@ -9,8 +9,8 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
BadgeHub: b513b8526ec71d5baddfacfc763f967d8ed8ff45
BadgeHub: 8632dc9ab9cfb1bee903ebd40f9de77d29323dc7

PODFILE CHECKSUM: c0e9ea82a511c7b3c636576ece9097ef9cc2e1ab

COCOAPODS: 1.6.1
COCOAPODS: 1.7.1
9 changes: 5 additions & 4 deletions Example/Pods/Local Podspecs/BadgeHub.podspec.json

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

6 changes: 3 additions & 3 deletions Example/Pods/Manifest.lock

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

Loading

0 comments on commit 509e162

Please sign in to comment.