Skip to content

Commit

Permalink
update ver 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mrustaa committed Apr 16, 2022
1 parent 96d28b0 commit a6f4bbe
Show file tree
Hide file tree
Showing 22 changed files with 182 additions and 121 deletions.
2 changes: 1 addition & 1 deletion ButtonClickStyle.podspec
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'ButtonClickStyle'
s.version = '1.1.1'
s.version = '1.2.0'
s.summary = 'This is a customizable designable button view. Inside layer you can style button, create your own subviews. Choose 15 click animation styles'

# This description is used to generate tags and improve search results.
Expand Down
58 changes: 41 additions & 17 deletions Example/ButtonClickStyle.xcodeproj/project.pbxproj
Expand Up @@ -232,6 +232,31 @@
sourceTree = "<group>";
};
4A14CBC22803437C00DA8A68 /* ButtonClickStyle */ = {
isa = PBXGroup;
children = (
4A477AC9280AEE280004156A /* Animations */,
4A477ACA280AEE3D0004156A /* UIDesignable */,
4A477ACB280AEE610004156A /* Style */,
4A14CBCE2803437C00DA8A68 /* ButtonClickStyleAddViewsAnimation.swift */,
4A14CBDA2803437C00DA8A68 /* ButtonClickStyleView.swift */,
4A14CBCC2803437C00DA8A68 /* ButtonClick.swift */,
4A14CBCB2803437C00DA8A68 /* ButtonClickState.swift */,
4A14CBCD2803437C00DA8A68 /* ButtonClicClosure.swift */,
4A14CBC92803437C00DA8A68 /* ButtonClickStyleGestureRecognizer.swift */,
);
path = ButtonClickStyle;
sourceTree = "<group>";
};
4A4545C22806C7570041D039 /* ButtonTableList */ = {
isa = PBXGroup;
children = (
4A4545C32806C7570041D039 /* ButtonTableListViewController.swift */,
4A4545C42806C7570041D039 /* ButtonTableListViewController.storyboard */,
);
path = ButtonTableList;
sourceTree = "<group>";
};
4A477AC9280AEE280004156A /* Animations */ = {
isa = PBXGroup;
children = (
4A14CBD02803437C00DA8A68 /* ButtonClickStyleAnim+UIViewAlpha.swift */,
Expand All @@ -245,29 +270,28 @@
4A14CBD82803437C00DA8A68 /* ButtonClickStyleAnim+UIViewFlash.swift */,
4A14CBD92803437C00DA8A68 /* ButtonClickStyleAnim+UIViewPress.swift */,
4A85B5A22803D59800DFD435 /* ButtonClickStyleAnim+UIViewGlare.swift */,
);
path = Animations;
sourceTree = "<group>";
};
4A477ACA280AEE3D0004156A /* UIDesignable */ = {
isa = PBXGroup;
children = (
4A62F30D2803115C00534ABA /* ButtonClickStyleDesignLabel.swift */,
4A62F30E2803115C00534ABA /* ButtonClickStyleDesignView.swift */,
4A14CBC52803437C00DA8A68 /* ButtonClickStyleShort.swift */,
4A14CBC62803437C00DA8A68 /* ButtonClickStyle.swift */,
4A231B79280A82250073284C /* ButtonClickStyleEmoji.swift */,
4A14CBC72803437C00DA8A68 /* ButtonClickStyleBase.swift */,
4A14CBC92803437C00DA8A68 /* ButtonClickStyleGestureRecognizer.swift */,
4A14CBCE2803437C00DA8A68 /* ButtonClickStyleAddViewsAnimation.swift */,
4A14CBDA2803437C00DA8A68 /* ButtonClickStyleView.swift */,
4A14CBCB2803437C00DA8A68 /* ButtonClickState.swift */,
4A14CBCC2803437C00DA8A68 /* ButtonClick.swift */,
4A14CBCD2803437C00DA8A68 /* ButtonClicClosure.swift */,
);
path = ButtonClickStyle;
path = UIDesignable;
sourceTree = "<group>";
};
4A4545C22806C7570041D039 /* ButtonTableList */ = {
4A477ACB280AEE610004156A /* Style */ = {
isa = PBXGroup;
children = (
4A4545C32806C7570041D039 /* ButtonTableListViewController.swift */,
4A4545C42806C7570041D039 /* ButtonTableListViewController.storyboard */,
4A14CBC52803437C00DA8A68 /* ButtonClickStyleShort.swift */,
4A14CBC62803437C00DA8A68 /* ButtonClickStyle.swift */,
4A231B79280A82250073284C /* ButtonClickStyleEmoji.swift */,
4A14CBC72803437C00DA8A68 /* ButtonClickStyleBase.swift */,
);
path = ButtonTableList;
path = Style;
sourceTree = "<group>";
};
4A62F3102803115C00534ABA /* LoadNib */ = {
Expand Down Expand Up @@ -1020,7 +1044,7 @@
DEVELOPMENT_TEAM = Y7546NLJW9;
INFOPLIST_FILE = ButtonClickStyle/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.1.1;
MARKETING_VERSION = 1.2.0;
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = mrusta.ButtonClickStyle;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -1041,7 +1065,7 @@
DEVELOPMENT_TEAM = Y7546NLJW9;
INFOPLIST_FILE = ButtonClickStyle/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.1.1;
MARKETING_VERSION = 1.2.0;
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = mrusta.ButtonClickStyle;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
4 changes: 2 additions & 2 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

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

100 changes: 57 additions & 43 deletions README.md
Expand Up @@ -44,7 +44,6 @@ pod 'ButtonClickStyle'
3) In Attributes Inspector of Interface Builder
you can immediately select the button click style `animationType`


![image](https://github.com/mrustaa/GifPresentations/blob/master/ButtonClickStyle/click_styles_example_2x_10sec33fps.gif)

```swift
Expand Down Expand Up @@ -74,58 +73,73 @@ extension ButtonClick {
5) Add animation duration `animationDuration`

6) Add animation value `animationTypeValue` - meaning means
- "Hide .Alpha/Flash/Shadow/Color" - will change alpha from 0.0 to 1.0
- "Move .Pulsate/Press/Shake" - will increase movement decrease from 0.0 to 1.0
- "Add .AndroidClickable" - will increase bubble radius


```swift
@IBInspectable var allSubviews: Bool = true
@IBInspectable var animationType: Int = 0
@IBInspectable var animationValue: CGFloat = 0.0
@IBInspectable var animationDuration: CGFloat = 0.0

var addViews: [UIView]?
```
- "Hide .Alpha/.Flash" - will change alpha from 0.0 to 1.0
- "Add .Shadow/.Color/.ColorFlat"
- "Move .Pulsate/.Press/.Shake" - will increase movement decrease from 0.0 to 1.0
- "TapGesture .Fave/.AndroidClickable" - will increase bubble radius
- "Loading .Glare" -

<!-- ![image](https://github.com/mrustaa/GifPresentations/blob/master/ButtonClickStyle/ui3.gif) -->

7) If initializing programmatically
There is a property `addViews` - allows you to pass views / layers
which you definitely want to use in the click animation only

```swift
@IBOutlet var mainView: UIView!

var views: [UIView]? = [mainView]
let frame: CGRect = .init(x: 23 , y: 22, width: 156, height: 48)
let viewAn = ButtonClickStyleView(
state: state,
frame: frame,
radius: 20,
addViews: views
)
btnView.insertSubview(mainView, at: 0)
btnView.updateSubviews()

```


8) Or initialize through a struct `ButtonClick.State`

```swift
extension ButtonClick {
struct State: Equatable {
var titleText: String?
var allSubviews: Bool = true
var animationType: Int?
var animationTypeValue: CGFloat?
var animationDuration: CGFloat?
var new: Bool = false
var color: UIColor?
var startClick: Bool = false
var debugButtonShow: Bool = false
var addBackgrondColor: Bool = true
import ButtonClickStyle
import UIKit

class ViewController: UIViewController {

@IBOutlet var xibButtonClickStyleView: ButtonClickStyleView?

var prgmButtonClickStyleView: ButtonClickStyleView?
var prgmFigureView: UIView!
var prgmRectangleView: UIView!

//MARK: - Create Programmaticaly

override func viewDidLoad() {
super.viewDidLoad()

let figureView = UIView(frame: .init(x: 50, y: 10, width: 80, height: 40))
figureView.backgroundColor = .systemIndigo
figureView.layer.cornerRadius = 20
self.prgmFigureView = figureView

let rectangleView = UIView(frame: .init(x: 15, y: 50, width: 50, height: 60))
rectangleView.backgroundColor = .systemPurple
self.prgmRectangleView = rectangleView

let state = ButtonClick.State(
titleText: "Hello", // debug text button
allSubviews: true, // click animation all subviews
animationType: 2, // style 15
animationTypeValue: 0.5, // value - alpha/power move
animationDuration: nil, // anim duration
new: false, // same styles one of them new
color: UIColor.green, // value color for styles shadowColor/color/colorFlat
startClick: true, // animate on creation
debugButtonShow: false, // debug highlight the real button inside
addBackgrondColor: true // debug add background color/view
)

let btnView = ButtonClickStyleView(
state: state,
frame: .init(x: 0, y: 300, width: 240, height: 128),
radius: 20,
addViews: [figureView] // addViews - allows you to pass views / layers which you definitely want to use in the click animation only
)
btnView.backgroundColor = .yellow.withAlphaComponent(0.5)

btnView.updateSubviews()
self.prgmButtonClickStyleView = btnView

btnView.addSubview(figureView)
btnView.addSubview(rectangleView)
self.view.addSubview(btnView)
}
}
```
Expand Down
25 changes: 24 additions & 1 deletion Source/ButtonClickStyle/ButtonClickState.swift
Expand Up @@ -20,6 +20,29 @@ extension ButtonClick {
var startClick: Bool = false
var debugButtonShow: Bool = false
var addBackgrondColor: Bool = true

public init(
titleText: String? = nil,
allSubviews: Bool = true,
animationType: Int? = nil,
animationTypeValue: CGFloat? = nil,
animationDuration: CGFloat? = nil,
new: Bool = false,
color: UIColor? = nil,
startClick: Bool = false,
debugButtonShow: Bool = false,
addBackgrondColor: Bool = true
) {
self.titleText = titleText
self.allSubviews = allSubviews
self.animationType = animationType
self.animationTypeValue = animationTypeValue
self.animationDuration = animationDuration
self.new = new
self.color = color
self.startClick = startClick
self.debugButtonShow = debugButtonShow
self.addBackgrondColor = addBackgrondColor
}
}

}

0 comments on commit a6f4bbe

Please sign in to comment.