A Swift library to provide a bouncy action sheet

Overview

Main

Hokusai is a Swift library that provides a bouncy action sheet.
It will give the users a fancy experience without taking pains coding the cool animation.
Hokusai is compatible with Swift3.

Version Platform CI Status Carthage compatible

Installation

Drop in the Classes folder to your Xcode project.
You can also use cocoapods or Carthage.

Using cocoapods

Add pod 'Hokusai' to your Podfile and run pod install. Also add use_frameworks! to the Podfile.

use_frameworks!
pod 'Hokusai'

Using Carthage

Add github "ytakzk/Hokusai" to your Cartfile and run carthage update. If unfamiliar with Carthage then checkout their Getting Started section.

github "ytakzk/Hokusai"

Demo

Demo

Hokusai Usage

Import Hokusai import Hokusai then use the following codes in some function except for viewDidLoad.

let hokusai = Hokusai()

// Add a button with a closure
hokusai.addButton("Button 1") {
    println("Rikyu")
}

// Add a button with a selector
hokusai.addButton("Button 2", target: self, selector: Selector("button2Pressed"))

// Set a font name. AvenirNext-DemiBold is the default. (Optional)
hokusai.fontName = "Verdana-Bold"

// Select a color scheme. Just below you can see the dafault sets of schemes. (Optional)
hokusai.colorScheme = HOKColorScheme.Enshu

// Show Hokusai
hokusai.show()

// Selector for button 2
func button2Pressed() {
    println("Oribe")
}

// Change a title for cancel button. Default is Cancel. (Optional)
hokusai.cancelButtonTitle = "Done"

// Add a callback for cancel button (Optional)
hokusai.cancelButtonAction = {
    println("canceled")
}

Add a title and message

// Init with title
let hokusai = Hokusai(headline: "Information")

// Init with title and message
let hokusai = Hokusai(headline: "Information", message: "This can be a long multi-lined message.")

// ...or add title and message later, but before you call `show()`
hokusai.headline = "Infomration"
hokusai.message  = "This can be a long multi-lined message."

Add a button with a closure

hokusai.addButton("Button Title") {
    // Do anything you want
}

Add a button with a selector

hokusai.addButton("Button Title", target: self, selector: Selector("buttonPressed"))

func buttonPressed() {
    // Do anything you want
}

Color schemes

Demo

public enum HOKColorScheme {
    case  Hokusai,
          Asagi,
          Matcha,
          Tsubaki,
          Inari,
          Karasu,
          Enshu
}

Or you can use your favorite color combination.

hokusai.colors = HOKColors(
    backGroundColor: UIColor.blackColor(),
    buttonColor: UIColor.purpleColor(),
    cancelButtonColor: UIColor.grayColor(),
    fontColor: UIColor.whiteColor()
)

Author

ytakzk
https://ytakzk.me

Donation

Your support is welcome through Bitcoin 3Ps8tBgz4qn6zVUr5D1wcYrrzYjMgEugqv

License

Hokusai is released under the MIT license.
See LICENSE for details.

Comments
  • Fix for rotation issue

    Fix for rotation issue

    There is an issue to the rotation Portrait -> Landscape To recreate the problem: Launch the app in portrait. do not rotate Open the menu when the device is still vertically Rotate the device

    • the shapeLayer.fillColor is drew with portrait dimensions ("background" half coloured, half transparent)

    My fix menuView. shapeLayer. frame = frame menuView. menuView. shapeLayer. bounds. origin = origin menuView. frame. menuView. updatePath () //ADD THIS LINE menuView. shapeLayer. layoutIfNeeded () menuView. layoutIfNeeded ()

    I don't know if it's the right time to call menuView.updatePath() Perhaps it would be better to call it somewhere else or change something else

    opened by rogomantik 7
  • HOKColors' cannot be constructed because it has no accessible: initializers

    HOKColors' cannot be constructed because it has no accessible: initializers

    Hi, I tried this simple code:

           let hokusai = Hokusai()
    
            // Add a button with a closure
            hokusai.addButton("Button 1") {
                println("Rikyu")
            }
    
            // Add a button with a selector
            hokusai.addButton("Button 2", target: self, selector: Selector("button2Pressed"))
    
            // Set a font name. AvenirNext-DemiBold is the default. (Optional)
            hokusai.fontName = "Verdana-Bold"
    
            // Select a color scheme. Just below you can see the dafault sets of schemes. (Optional)
            hokusai.colorScheme = HOKColorScheme.Karasu
    
            hokusai.colors = HOKColors(
                backGroundColor: UIColor.blackColor(),
                buttonColor: UIColor.purpleColor(),
                cancelButtonColor: UIColor.grayColor(),
                fontColor: UIColor.whiteColor()
            )
    
            // Show Hokusai
            hokusai.show()
    
            // Selector for button 2
            func button2Pressed() {
                println("Oribe")
            }
    
            // Change a title for cancel button. Default is Cancel. (Optional)
            hokusai.cancelButtonTitle = "Done"
    
            // Add a callback for cancel button (Optional)
            hokusai.cancelButtonAction = {
                println("canceled")
            }
    

    but i have this error, do you had never seen it before?

    HOKColors' cannot be constructed because it has no accessible: initializers

    opened by enricopiovesan 4
  • On Rotation issue

    On Rotation issue

    Hello, I have just used your library. It looks very convenient and great. But I found out, there is an issue, if I rotate a phone, menu will not adjust properly.

    opened by Vaberer 4
  • Swift 3.0 support

    Swift 3.0 support

    Added Swift 3.0 support.

    • Hokusai.dismiss() is now Hokusai.dismissHokusai() since it was conflicting with UIViewController's dismiss(animated:)

    I did not update the version in the podspec though. I think the owner should decide the new version

    opened by gkaimakas 1
  • Fix for cancel button title

    Fix for cancel button title

    line 351 // Add a cancel button self.addCancelButton("Done") ///here

        // Decide the menu size
    

    should be self.addCancelButton(cancelButtonTitle)

    opened by rogomantik 1
  • Add title and message to Hokusai action sheet

    Add title and message to Hokusai action sheet

    As promised I took some time to add my changes in a more general usable manner.

    You can initialize Hokusai with a headline and/or a message which will than be displayed in the action sheet. Both properties are public, so they can also be set and changed afterwards. To display the message I also introduced a lightFontName property which when set is used for the message.

    Unfortunately I did not find a easy way to use title as the property name, because it is already used by UIViewController. Maybe somebody else sees a neat way?

    Relates to: #10

    opened by limfinity 0
  • Hokusai.swift pulled from Cocoapods differs from Hokusai.swift in Github repo

    Hokusai.swift pulled from Cocoapods differs from Hokusai.swift in Github repo

    Swift Compiler Error after updating to Swift: "Argument of '#selector' refers to instance method 'tick' that is not exposed to Objective-C"

    Based on my research, adding @objc would expose these instance methods to Objective-C and I see that in the Hokusai.swift file of your latest Hokusai version (0.4.0) on Github you have those @objc attributes. However, when I install the latest Hokusai pod via Cocoapods, I do not see these attributes in the Hokusai file.

    Not sure why the Hokusai.swift pulled from Cocoapods differs from the Hokusai.swift here in the repo (the 6 missing @objc attributes seem to be the only difference). For example, in the Hokusai.swift file of the latest master branch, it correctly shows the attribute for example: @objc func tick(_ displayLink: CADisplayLink) But in the Hokusai.swift file in my Xcode project, I do not see this @objc attribute, even though I installed the latest Hokusai (0.4.0) (via pod Hokusai in my Podfile). @ytakzk

    opened by dnadri 0
  • Swift Compiler Error after updating to Swift 4

    Swift Compiler Error after updating to Swift 4

    I've encountered some compiler error after upgrading to Swift 4. Xcode Version 9.1

    Pods/Hokusai/Classes/Hokusai.swift:186:65: Argument of '#selector' refers to instance method 'tick' that is not exposed to Objective-C

    Pods/Hokusai/Classes/Hokusai.swift:285:64: Argument of '#selector' refers to instance method 'onOrientationChange' that is not exposed to Objective-C

    /Pods/Hokusai/Classes/Hokusai.swift:353:36: Argument of '#selector' refers to instance method 'buttonTapped' that is not exposed to Objective-C

    And counting...How can fix this?

    Thanks in advance

    opened by lucamicheli 3
  • Pop down from top of screen

    Pop down from top of screen

    Hello!

    Love your pod, super easy to implement! Only issue i'm having is that it's slightly hard to customize!

    What I am trying to do is make it so that instead of animating up from the bottom of the screen, it animates down form the top of the screen. I've been trying for a couple days now on and off, but if this is something that would be an easy tweak, please let me know!

    Thanks!

    enhancement 
    opened by stopitdan 0
  • Issue!!

    Issue!!

    I have added Hokusai.show on a button Action and the problem that i have observed is that a cancel button gets added when ever I click on my Added button.Please suggest if this is an issue or implementation fault.

    I some how managed to resolve the issue too but I did that by manipulating a line of code in your class Hokusai.swift. Where i commented the code as follow:

    // Add a cancel button // self.addCancelButton(cancelButtonTitle)

    opened by Anurag171992 0
Owner
Yuta Akizuki
Yuta Akizuki
zekunyan 608 Dec 30, 2022
Fully customizable and extensible action sheet controller written in Swift

XLActionController By XMARTLABS. XLActionController is an extensible library to quickly create any custom action sheet controller. Examples The action

xmartlabs 3.3k Dec 31, 2022
A Google like action sheet for iOS written in Swift.

MaterialActionSheetController Lightweight and totally customizable. Create and present it the way you do with UIAlertController. Screenshots Demo | De

Thanh-Nhon NGUYEN 103 Jun 29, 2022
Action sheet allows including your custom views and buttons.

CustomizableActionSheet Action sheet allows including your custom views and buttons. Installation CocoaPods Edit your Podfile: pod 'CustomizableAction

Ryuta Kibe 191 Nov 26, 2021
It is a highly configurable iOS library which allows easy styling with built in styles as well as extra header and footer views so that you can make extremely unique alerts and action sheets.

 CFAlertViewController CFAlertViewController is a library that helps you display and customise Alerts, Action Sheets, and Notifications on iPad and i

Crowdfire Inc. 1.1k Dec 18, 2022
DGBottomSheet - The lightest swift bottom sheet library

DGBottomSheet Requirements Installation Usage DGBottomSheet The lightest swift b

donggyu 9 Aug 6, 2022
Customizable Dynamic Bottom Sheet Library for iOS

DynamicBottomSheet Powerd by Witi Corp., Seoul, South Korea. Fully Customizable Dynamic Bottom Sheet Library for iOS. This library doesn't support sto

Witi Official 10 May 7, 2022
An iOS library for SwiftUI to create draggable sheet experiences similar to iOS applications like Maps and Stocks.

An iOS library for SwiftUI to create draggable sheet experiences similar to iOS applications like Maps and Stocks.

Wouter 63 Jan 5, 2023
A Floating Action Button just like Google inbox for iOS

VCFloatingActionButton A Floating Action Button inspired from Google inbox for iOS. Using this in your project Import the VCFloatingActionButton to yo

Giridhar 298 May 16, 2022
ActionBee is a programmable pasteboard action trigger.

ActionBee ActionBee is a programmable pasteboard action trigger. Preview Video It can be used to clean your URL in text. To see code or import this mo

Derek Jones 2 Aug 24, 2022
BottomSheetDemo - Bottom sheet modal view controller with swift

当我们想弹出一个预览视图,bottom sheet modal view controller 非常实用。在 iOS 中,长按拖拽手势可以让 controlle

null 8 Oct 29, 2022
Dice roller, character sheet/ creator, and monster/item info app on the iphone12

DnD-LordDogMaw This file will be the start of a side project in the hopes of creating an iphone12 app for Dungeons and Dragons! This app will have 3 m

Paige Guajardo 2 Sep 17, 2021
Present a sheet ViewController easily and control ViewController height with pangesture

PanControllerHeight is designed to present a sheet ViewController easily and control ViewController height with pangesture.

null 2 May 3, 2022
SwiftUI Draggable Bottom Sheet

SwiftUI Draggable Bottom Sheet

paigeshin 2 Mar 3, 2022
Bottom Sheet component is widely used in Joom application

Bottom Sheet Bottom Sheet component is widely used in Joom application Installation Swift Package Manager Swift Package Manager is a tool for managing

Joom 101 Dec 29, 2022
A SwiftUI Partial Sheet fully customizable with dynamic height

A SwiftUI Partial Sheet fully customizable with dynamic height

Andrea Miotto 1.4k Jan 5, 2023
Share-sheet-example - A sample project that reproduces an issue with Share Sheets

Hello, DTS! This project demonstrates the issue I'm having with the Share Sheet.

Marcos Tanaka 0 Feb 11, 2022
SplitSheet - A lightweight, fully interactive split-screen sheet.

SplitSheet A lightweight, fully interactive split-screen sheet. Powered by UIScrollView for super-smooth gestures. Show/hide either programmatically o

Andrew Zheng 154 Dec 15, 2022
This is a small View modifier that adds detents for native .sheet representations that appeared in iOS 16

SheetDetentsModifier This is a small View modifier that adds detents for .sheet representations that appeared in iOS 16 It works starting with iOS 15

Alex Artemev 19 Oct 9, 2022