romeugodoi / MaterialDesignWidgetsiOSLite

Material design styled buttons, vertically arranged buttons, activity loader and loading button.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Material Design Widgets - Lightweight

This framework give you full flexibility to apply any material design widget you would like to use in your app! Please see below steps if you only need to use one or two of the entire package widgets.

Generic badge Generic badge Generic badge Generic badge Generic badge

overview

You may download MaterialDesignWidgetsDemo to see how its used in your app.

Key Features

  • A full package of material design widgets that you'll need to upgrade your app's visual.
  • Widget classes are made to be open, which gives you flexibility to create your own.
  • Instead of pull down the entire package, you can also copy the source of any widget you need independently.
  • If you decide to just use one of the widgets, you can follow below usage for instructions on which files you need for that specific widget.

Requirements

  • Swift 5.0
  • iOS 11.0+

Usage

Buttons

Files needed:

  1. RippleLayer.swift
  2. MaterialButton.swift

Normal Button

let btnSample1 = MaterialButton(text: "Sample1", cornerRadius: 15.0)
let btnSample2 = MaterialButton(text: "Sample2", textColor: .black, bgColor: .white)

button

Loading Button

let btnLoading = MaterialButton(text: "Loading Button", cornerRadius: 15.0)
loadingBtn.addTarget(self, action: #selector(tapLoadingButton(sender:)), for: .touchUpInside)

@objc func tapLoadingButton(sender: MaterialButton) {
	sender.isLoading = !sender.isLoading
	sender.isLoading ? sender.showLoader(userInteraction: true) : sender.hideLoader()
}

loadingButton

Shadow Button

let btnShadow = MaterialButton(text: "Shadow Button", cornerRadius: 15.0, withShadow: true)

shadowButton

Vertical Aligned Button

let img = UIImage(named: "Your image name")
let btnV = MaterialVerticalButton(icon: img, title: "Fill", foregroundColor: .black, bgColor: .white)

verticalButton

Segmented Control

Files needed:

  1. MaterialSegmentedControl.swift
var segments = [UIButton]() // Segments are in the Button form.
for i in 0..<3 {
	let button = MaterialButton(text: "Segment \(i)", textColor: .gray, bgColor: .clear, cornerRadius: 18.0)
	segments.append(button)
}

Filled

let sgFilled = MaterialSegmentedControl(segments: segments, selectorStyle: .fill, textColor: .black, selectorTextColor: .white, selectorColor: .black)

// Below is styling, you can write your own.
sgFilled.backgroundColor = .lightGray
sgFilled.setCornerBorder(cornerRadius: 18.0)

segmentFill

Outline

let sgOutline = MaterialSegmentedControl(segments: segments, selectorStyle: .line, textColor: .black, selectorTextColor: .white, selectorColor: .black)

segmentOutline

Line

let sgLine = MaterialSegmentedControl(selectorStyle: .line, textColor: .black, selectorTextColor: .black, selectorColor: .black, bgColor: .white)

segmentLine

TextField

Files needed:

  1. RippleLayer.swift
  2. MaterialTextField.swift
let textField = MaterialTextField(hint: "TextField", textColor: .black, bgColor: .white)

textField

Loading Indicator

Files needed:

  1. MaterialLoadingIndicator.swift
let indicatorBlack = MaterialLoadingIndicator(radius: 15.0, color: .black)
indicatorBlack.startAnimating()
let indicatorGray = MaterialLoadingIndicator(radius: 15.0, color: .gray)
indicatorGray.startAnimating()

loading

Installation

MaterialDesignWidgets is available through CocoaPods. To install it, simply add the following line to your Podfile:

$ pod 'MaterialDesignWidgets'

If you don't use CocoaPods, you can download the entire project then drag and drop all the classes and use them in your project.

Credits

About

Material design styled buttons, vertically arranged buttons, activity loader and loading button.

License:MIT License


Languages

Language:Swift 91.1%Language:Ruby 8.1%Language:Objective-C 0.7%