IGStoryButtonKit provides an easy-to-use button with rich animation and multiple way inspired by instagram story/stories.

Overview

Swift-version CocoaPods Carthage License

Introduction

Have you ever seen UI like instagram story, haven't you? Actually, features like instagram story have been implemented in many applications recently.

In order to implement these features like instagram story or rich UI quickly, IGStoryButtonKit provides an easy-to-use button so called IGStoryButton with rich animation and multiple way inspired by instagram story.

Usage and Example

Display Type

IGStoryButton has four display types; seen, unseen, status, none as the part of IGStoryButton.DisplayType. (status has two type; one is set color as an argument, the other is set image as an argument.) The appearance of IGStoryButton depends on these display types.

Color Type

Circle ring which surrounds IGStoryButton has four color types: default, black, clear, custom as the part of IGStoryButton.ColorType.

default black clear custom(colors:)
actual value [UIColor.systemPink, UIColor.orange] [UIColor.black, UIColor.lightGray] [UIColor.clear] value set in argument

Appearance by specific display and color types

The detail is as follows. Once you only set DisplayType, color of outside circle ring is automatically set as default color for the first time.

seen unseen status(color:) status(image:) none
appearance
default color ColorType.black ColorType.default ColorType.clear ColorType.clear ColorType.clear

Customize Color and Image

You can customize which color is set to circle ring, status view in the lower right named in statusView after that and which image is set to status as follows. If you configure display and color type of IGStoryButton, you first import IGStoryButtonKit and set value to the property named condition derived from IGStoryButton.TypeCondition consisted of IGStoryButton.DisplayType, IGStoryButton.ColorType.

Please refer to these codes, comments and implementation of sample app named in ExampleApp.

// import this module
import IGStoryButtonKit

// storyButton: instance after initialization via code or interface builder
// set displayType as .seen, and default color is set to color of circle ring because colorType is not set specifically 
storyButton.condition = .init(display: .seen)
// same thing with above
storyButton.condition = IGStoryButton.TypeCondition(display: .seen)

// if you set color to statusView, you set StatusView.DisplayType.color(of:) as type and specific color as UIColor in the argument of StatusView.DisplayType.color
storyButton.condition = .init(display: .status(type: .color(of: UIColor.green)))

// if you set image to statusView, you set StatusView.DisplayType.image(of:) as TypeCondition.DisplayType and specific image as UIImage in the argument of StatusView.DisplayType.image
storyButton.condition = .init(display: .status(type: .image(of: UIImage(named: "ramen"))))

// if you customize color of circle ring, you set ColorType.custom(colors:) in the argument as TypeCondition.ColorType and set the specific array consisted of UIColor to the argument of ColorType.custom
storyButton.condition = .init(display: .status(type: .color(of: UIColor.green)), color: .custom(colors: [UIColor.cyan, UIColor.yellow, UIColor.gray]))

Indicator Manipulation

You can manipulate whether circle ring performs like activity indicator or not. If you want to start loading, execute startAnimating(speed:, alpha:). Besides, if you want to stop loading, execute stopAnimating.

// storyButton: instance after initialization via code or interface builder
// if you want to set rotation speed and alpha of button, set these in argument of startAnimating(speed:, alpha):
storyButton.startAnimating() // speed: 0.2, alpha: 0.7
storyButton.stopAnimating()

Important Notification

IGStoryButton is initialized by code or interface builder, but the size of width and height is required to be equal. If the size of width is different from one of width, fatalError("The size of width and height are required to be equal") is expected to be occurred.

Requirements

Swift 5.3+
iOS 13.0+
Xcode 12.0+

Installation

CocoaPods

Add following to your Podfile and execute pod install

target 'MyApp' do
  pod 'IGStoryButtonKit'
end

Carthage

Add following to your Cartfile and execute carthage bootstrap --platform iOS --use-xcframeworks, and finally import xcframeworks in your project

github "KaoruMuta/IGStoryButtonKit"

Swift Package Manager

Enter this: https://github.com/KaoruMuta/IGStoryButtonKit as Swift Package

Contribution

If you find any issue, please let me know on Issues. Also, If you propose and implement new features, please open Pull Requests following templates.

Let's discuss together to improve that this OSS becomes more convenient for developers! p.s. I'm really happy and improve a motivation to give me star :)

Future Work

  • Introduce loading animation with dash line to make current animation richer (High Priority, but it seems difficult)
  • Styling design something else (ex. border's width)
  • Code refactor

License

Under MIT

You might also like...
Easily customizable floating button menu created with SwiftUI
Easily customizable floating button menu created with SwiftUI

FloatingButton Easily customizable floating button menu created with SwiftUI We are a development agency building phenomenal apps. Usage Create main b

Floaty is simple floating action button for iOS.
Floaty is simple floating action button for iOS.

Floaty is simple floating action button for iOS. (formerly KCFloatingActionButton) Why change the name? Follow the swift naming convention. KCF

Lickable-Button We made the buttons on the screen look so good you'll want to lick them

Lickable-Button We made the buttons on the screen look so good you'll want to lick them. - Steve Jobs A little SwiftUI button project at WWDC 2021 Lic

Craft that perfect SwiftUI button effect 👌🏼
Craft that perfect SwiftUI button effect 👌🏼

buttoncraft (SwiftUI 3.0 App) Experimenting with SwiftUI 3.0 whilst creating a practical app to craft that perfect button style. ✈️ Testflight https:/

iOS Pod for a Soft UI (Neumorphic) Button for UIKit written in Swift
iOS Pod for a Soft UI (Neumorphic) Button for UIKit written in Swift

iOS Pod for a Soft UI (Neumorphic) Button for UIKit written in Swift

Custom loading button with progress swiftui

CustomLoadingButton Simple Custom Loading Progress Button for SwiftUI Version 1.0.0 This version requires Xcode 11+ SwiftUI iOS 13+ macOS 10.15+ Insta

iOS 7-style bouncy button.

SSBouncyButton SSBouncyButton is simple button UI component with iOS 7-style bouncy animation. Take A Look Try It! pod 'SSBouncyButton', '~ 1.0' Use

Flat button with 9 different states using POP
Flat button with 9 different states using POP

VBFPopFlatButton Flat button with 21 different states and 2 types animated using pop. These are some examples of both types in different states: And h

Flat design pressable button for iOS developers.
Flat design pressable button for iOS developers.

HTPressableButton HTPressableButton is designed for iOS developers to be able to spend time developing ideas, not building basic buttons. These stylis

Comments
  • refactor(project): remove deprecated stuff and reformat markdown

    refactor(project): remove deprecated stuff and reformat markdown

    What is the type of this PR? (ex. bugfix, new feature etc.)

    Refactoring

    What is changed in this PR? (Please describe the effectiveness/improvement)

    • Change for removing deprecated stuff (class -> AnyObject)
    • Reformat code

    Check if the PR fulfills these requirements

    • [x] Build successfully
    • [x] Work correctly
    • [x] Pass all test
    opened by KaoruMuta 0
  • docs: update README to add the information about carthage, pods

    docs: update README to add the information about carthage, pods

    What is the type of this PR? (ex. bugfix, new feature etc.)

    docs update

    What is changed in this PR? (Please describe the effectiveness/improvement)

    Update README to add the information about how to use via Carthage and modify the provided pod version

    Check if the PR fulfills these requirements

    • [x] Build successfully
    • [x] Work correctly
    • [x] Pass all test
    opened by KaoruMuta 0
  • test: add unittest and uitest to improve code coverage

    test: add unittest and uitest to improve code coverage

    What is the type of this PR? (ex. bugfix, new feature etc.)

    Test, Improvement

    What is changed in this PR? (Please describe the effectiveness/improvement)

    Add unittest and uitest

    Check if the PR fulfills these requirements

    • [x] Build successfully
    • [x] Work correctly
    • [x] Pass all test
    opened by KaoruMuta 0
  • ci: introduce GitHub Actions

    ci: introduce GitHub Actions

    What is the type of this PR? (ex. bugfix, new feature etc.)

    DevOps

    What is changed in this PR? (Please describe the effectiveness/improvement)

    Setup CI

    Check if the PR fulfills these requirements

    • [x] Build successfully
    • [x] Work correctly
    • [x] Pass all test
    opened by KaoruMuta 0
Releases(1.0.2)
  • 1.0.2(May 29, 2022)

    What's Changed

    • refactor(project): remove deprecated stuff and reformat markdown by @KaoruMuta in https://github.com/KaoruMuta/IGStoryButtonKit/pull/4

    Full Changelog: https://github.com/KaoruMuta/IGStoryButtonKit/commits/1.0.2

    Source code(tar.gz)
    Source code(zip)
  • 1.0.1(Jan 12, 2021)

  • 1.0.0(Jan 6, 2021)

Customizable download button with progress and transition animations. It is based on Apple's App Store download button.

AHDownloadButton is a customizable download button similar to the download button in the latest version of Apple's App Store app (since iOS 11). It fe

Amer Hukić 465 Dec 24, 2022
Revamped Download Button. It's kinda a reverse engineering of Netflix's app download button.

NFDownloadButton Revamped Download Button Requirements Installation Usage License Requirements iOS 8.0+ Swift 4.2+ Xcode 10.0+ Installation CocoaPods

Leonardo Cardoso 433 Nov 15, 2022
Customizable and easy to use expandable button in Swift.

ExpandableButton Requirements iOS 9.0+ Installation CocoaPods: Add the following line to your Podfile: pod 'ExpandableButton' #for swift less than 4.

Dmytro Mishchenko 98 Dec 5, 2022
LTHRadioButton - A radio button with a pretty animation

LTHRadioButton Slightly inspired by Google's material radio button. The clip below has 3 sections: full speed, 25% and 10%, but after converting it to

Roland Leth 368 Dec 16, 2022
Jorge Ovalle 305 Oct 11, 2022
An open-source library to use with SwiftUI, It allows you to create Floating menu action button.

Floating Menu Action Button Example Overview This is an open-source library to use with SwiftUI. It allows you to create Floating menu action button. Ins

ugo 3 Aug 19, 2022
Simple and customizable button in Swift

SwiftyButton Maintainer(s): @nickm01 @pmacro @aryamansharda Simple and customizable button in Swift. Installation Cocoapods pod 'SwiftyButton' Cartha

Scoop 542 Dec 13, 2022
Animated Play and Pause Button written in Swift, using CALayer, CAKeyframeAnimation.

AnimatablePlayButton Animated Play and Pause Button written in Swift, using CALayer, CAKeyframeAnimation. features Only using CAShapeLayer, CAKeyframe

keishi suzuki 77 Jun 10, 2021
Interactive and fully animated Material Design button for iOS developers.

WYMaterialButton Inspired by Google Material Design, written purely in Swift 3. WYMaterialButton implemented Material Design on iOS and add more dynam

Yu Wang 76 Oct 7, 2022
Cute Animated Button written in Swift.

DOFavoriteButton Cute Animated Button written in Swift. It could be just right for favorite buttons! Requirements iOS 7.0+ Swift 1.2 Installation Cart

Daiki Okumura 3.6k Dec 29, 2022