Git Product home page Git Product logo

swiftypickerpopover's Introduction

SwiftyPickerPopover

Popover with Picker by Swift 3 for iPhone/iPad, iOS9+.

Version License Platform Carthage compatible

Features

  • Popover with Picker which can be chosen from several types, appears on iPhone or iPad.
  • Swift 3, iOS9+. UIPopoverController free.
  • Callback

Required

  • Swift 3, Xcode 8. (If you want to use it on Swift 2.3, please check up SwiftyPickerPopover 1.1.0.)
  • iOS 9+
  • CocoaPods 1.1.0.rc.2+ or Carthage 0.12.0+

License

MIT.

Screenshots

Usage

For Installing with CocoaPods, specify it in your 'Podfile'.

platform :ios, '9.0'
use_frameworks!
pod 'SwiftyPickerPopover'

Run 'pod install'.

For Installing with Carthage, add it to your Cartfile.

github "hsylife/SwiftyPickerPopover"

On Xcode, import the module.

  import SwiftyPickerPopover

Basic

DatePickerPopover appears.

  DatePickerPopover.appearFrom(originView: button, baseViewController: self, title: "DatePicker", dateMode: .Date, initialDate: NSDate(), doneAction: { selectedDate in print("selectedDate \(selectedDate)")}, cancelAction: {print("cancel")})

StringPickerPopover appears.

  StringPickerPopover.appearFrom(originView: button, baseViewController: self, title: "StringPicker", choices: ["value 1","value 2","value 3"], initialRow:0, doneAction: { selectedRow, selectedString in print("done row \(selectedRow) \(selectedString)")} , cancelAction: { print("cancel")})

ColumnStringPickerPopover which has variable multiple components, appers.

  ColumnStringPickerPopover.appearFrom(originView: button, baseViewController: self, title: "Columns Strings",
            choices: [["Breakfast", "Lunch", "Dinner"], ["Tacos", "Sushi", "Steak", "Waffles", "Burgers"]],
            initialRow: [0,0],
            columnPercent: [0.5, 0.5],
            fontSize: 12.0,
            doneAction: { selectedRows, selectedStrings in print("selected rows \(selectedRows) strings \(selectedStrings)")}, cancelAction: {print("cancel")})

CountdownPickerPopover which returns interval time, appears.

CountdownPickerPopover.appearFrom(originView: sender, baseViewController: self, title: "CountdownPicker", dateMode: .countDownTimer, initialInterval: TimeInterval(), doneAction: { timeInterval in print("timeInterval \(timeInterval)")}, cancelAction: {print("cancel")})

Advanced

DatePickerPopover with clearAction

  DatePickerPopover.appearFrom(originView: button, baseViewController: self, title: "Clearable DatePicker", dateMode: .Date, initialDate: NSDate(), doneAction: { selectedDate in print("selectedDate \(selectedDate)")}, cancelAction: {print("cancel")}, clearAction: { print("clear")})

StringPickerPopover with displayStringFor

let displayStringFor:((String?)->String?)? = { string in
   if let s = string {
      switch(s){
      case "value 1":
        return "๐Ÿ˜Š"
      case "value 2":
         return "๐Ÿ˜"
      case "value 3":
         return "๐Ÿ˜“"
      default:
         return s
      }
    }
  return nil
  }
        
  StringPickerPopover.appearFrom(originView: button, baseViewController: self, title: "StringPicker", choices: ["value 1","value 2","value 3"], displayStringFor: displayStringFor, initialRow:0, doneAction: { selectedRow, selectedString in print("done row \(selectedRow) \(selectedString)")} , cancelAction: { print("cancel")})

Contributor

Ken Torimaru GitHub for CountdownPickerPopover and ColumnStringPickerPopover.

Author

Yuta Hoshino Twitter Facebook

swiftypickerpopover's People

Contributors

hsylife avatar ktorimaru avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.