A Customizable Switch UI for iOS, Inspired from Google's Material Design in Swift

Overview

MJMaterialSwitch

Overview

MJMaterialSwitch is google's material design like switch UI with animation features.

This library has cool and sophisticated animations, ripple effect and bounce effect. Also, customizable properties can be tweaked behaviors and enhance your application UI cool.

With this library, you can easily implement material design switch to your app.



Usage

The simplest setup by code:

let xPos: CGFloat = (UIScreen.main.bounds.width / 2 ) - 22.5
let yPos: CGFloat = (UIScreen.main.bounds.height / 2 ) + 50.0
self.switch2 = MJMaterialSwitch(frame: CGRect(x: xPos , y: yPos, width: 64, height: 60))
self.switch2.addTarget(self, action: #selector(switchStateChanged(_:)), for: UIControl.Event.valueChanged)
self.switch2.tarckEdgeInset = UIEdgeInsets(top: 18, left: 0, bottom: 18, right: 0)
self.switch2.tag = 2
switch2.trackOnTintColor = UIColor.red.withAlphaComponent(0.6)
switch2.thumbOnTintColor = UIColor.red

// Call update UI method in last.
switch2.updateUI()

self.view.addSubview(self.switch2)

This is the simplest and easiest initialization.

Usage by xib and Storyboard

  • Create UIView and set the MJMaterialSwitch class.
  • Create IBOutlet to add valueChanged target for the click actions

Customize Behaviors

MJMaterialSwitch has many prateters to customize behaviors as you like.

Style and size


var thumbOnTintColor: UIColor!
var thumbOffTintColor: UIColor!

var trackOnTintColor: UIColor!
var trackOffTintColor: UIColor!

var thumbDisabledTintColor: UIColor!
var trackDisabledTintColor: UIColor!

var isBounceEnabled: Bool = false
var isRippleEnabled: Bool = true
var rippleFillColor: UIColor = .gray
    

Author

Jaleel Nazir [email protected]
Buy me coffe: paypal

License

MJMaterialSwitch is available under the MIT license.

You might also like...
A Slide Menu, written in Swift, inspired by Slide Menu Material Design
A Slide Menu, written in Swift, inspired by Slide Menu Material Design

Swift-Slide-Menu (Material Design Inspired) A Slide Menu, written in Swift 2, inspired by Navigation Drawer on Material Design (inspired by Google Mat

Custom UIButton effect inspired by Google Material Design
Custom UIButton effect inspired by Google Material Design

ZFRippleButton iOS Custom UIButton effect inspired by Google Material Design written in Swift Usage Set the UIButton class in Nib to ZFRippleButton or

Modular and customizable Material Design UI components for iOS
Modular and customizable Material Design UI components for iOS

Material Components for iOS Material Components for iOS (MDC-iOS) helps developers execute Material Design. Developed by a core team of engineers and

Material design components for iOS written in Swift
Material design components for iOS written in Swift

MaterialKit NOTE: This project is unmaintained. Material design components (inspired by Google Material Design) for iOS written in Swift Please feel f

 iOS library Paper Onboarding is a material design UI slider written on Swift.
iOS library Paper Onboarding is a material design UI slider written on Swift.

iOS library Paper Onboarding is a material design UI slider written on Swift. We specialize in the designing and coding of custom UI

Material para a apresentação da palestra "Implementando Interesses Transversais - um papo sobre arquitetura, DI e Design Patterns em Swift/iOS" no TDC Future 2021

--- title: Implementando Interesses Transversais - um papo sobre arquitetura, DI e Design Patterns em Swift/iOS author: Cícero Camargo date: Nov 30th

Runkeeper design switch control
Runkeeper design switch control

DGRunkeeperSwitch Runkeeper design switch control (two part segment control) developed in Swift 2.0 Requirements Xcode 7-beta or higher iOS 8.0 or hig

Nicely animated flat design switch alternative to UISwitch
Nicely animated flat design switch alternative to UISwitch

AIFlatSwitch A smooth, nice looking and IBDesignable flat design switch for iOS. Can be used instead of UISwitch. Inspired by Creativedash's Dribbble

A Material Design drop down for iOS
A Material Design drop down for iOS

A Material Design drop down for iOS written in Swift. Demo Do pod try DropDown in your console and run the project to try a demo. To install CocoaPods

Blobmorphism is a brand new design language I've created to break free of the material overload in iOS, built in SwiftUI. Everything feels smooth and fluid.
Blobmorphism is a brand new design language I've created to break free of the material overload in iOS, built in SwiftUI. Everything feels smooth and fluid.

Blobmorphism is a brand new design language I've created to break free of the material overload in iOS, built in SwiftUI. Everything feels smooth and fluid.

A Material Design drop down for iOS
A Material Design drop down for iOS

A Material Design drop down for iOS written in Swift. Demo Do pod try DropDown in your console and run the project to try a demo. To install CocoaPods

Library provides easy to implement variation of Android (Material Design) Floating Action Button for iOS. You can use it as your app small side menu. 🌶
Library provides easy to implement variation of Android (Material Design) Floating Action Button for iOS. You can use it as your app small side menu. 🌶

RHSideButtons 🌶 Library provides easy to implement variation of Android (Material Design) Floating Action Button for iOS. You can use it as your app

Google Material Design Icons Font for iOS
Google Material Design Icons Font for iOS

GoogleMaterialDesignIcons #Google Material Design Icons Font for iOS It is based on https://github.com/google/material-design-icons. it converts the m

Interactive and fully animated Material Design button for iOS developers.
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

⭕️ CircleMenu is a simple, elegant UI menu with a circular layout and material design animations. Swift UI library made by @Ramotion
⭕️ CircleMenu is a simple, elegant UI menu with a circular layout and material design animations. Swift UI library made by @Ramotion

CIRCLE MENU Simple, elegant UI menu with a circular layout and material design animations We specialize in the designing and coding of custom UI for M

A swift library based on the various options menu in material design in Android
A swift library based on the various options menu in material design in Android

KTOptionMenu Description KTOptionMenu is a swift library based on the various options menu in material design in Android that allows you to easily cre

Google Material Design Icons for Swift and ObjC project
Google Material Design Icons for Swift and ObjC project

GoogleMaterialIconFont Google Material Design Icons for Swift and ObjC project This library is inspired by FontAwesome.swift Both Swift and Objctive-C

Material Design Floating Action Button in liquid state
Material Design Floating Action Button in liquid state

LiquidFloatingActionButton [] (https://github.com/Carthage/Carthage) LiquidFloatingActionButton is floating action button component of material design

ExpandingCollection is an animated material design UI card peek/pop controller.
ExpandingCollection is an animated material design UI card peek/pop controller.

EXPANDING COLLECTION An animated material design UI card peek/pop controller We specialize in the designing and coding of custom UI for Mobile Apps an

Releases(2.0)
Owner
Jaleel Nazir
Tech at Glynk
Jaleel Nazir
A Swift material design UI module which paints over the parent view when the switch is on.

A Swift material design UI module which paints over the parent view when the switch is on. We specialize in the designing and coding of c

Ramotion 2.9k Dec 29, 2022
Nicely animated flat design switch alternative to UISwitch

AIFlatSwitch A smooth, nice looking and IBDesignable flat design switch for iOS. Can be used instead of UISwitch. Inspired by Creativedash's Dribbble

null 963 Jan 5, 2023
💊 An iOS switch control implemented in Swift with full Interface Builder support

' :::=== ::: === === ::: :::==== :::===== ::: === ' ::: ::: === === ::: :::==== ::: ::: === ' ===== === === === === ===

Thanh Pham 145 Dec 7, 2022
An animation switch collection

TKSwitcherCollection An animate switch collection Requirements iOS 8.0+ Xcode 9.0 Swift 4.0 Installation CocoaPods You can use CocoaPods to install TK

TBXark 903 Dec 21, 2022
UISwitch which paints over the parent view with the color in Swift.

AnimatedSwitch Swift subclass of the UISwitch which paints over the parent view with the color if switch is turned on and returns original superview b

Alex Sergeev 248 Jul 26, 2022
Swift - Custom UISwitcher with animation when change status

Switcher Custom UISwitcher with animation. Thank to @andmironov for great design http://uimovement.com/ui/654/yet-another-toggle-animation/ Usage Add

Khoi Nguyen 205 Dec 5, 2022
A Customizable Switch UI for iOS, Inspired from Google's Material Design

Overview JTMaterialSwitch is google's material design like switch UI with animation features. This library has cool and sophisticated animations, ripp

Junichi Tsurukawa 319 Nov 28, 2022
A Swift material design UI module which paints over the parent view when the switch is on.

A Swift material design UI module which paints over the parent view when the switch is on. We specialize in the designing and coding of c

Ramotion 2.9k Dec 29, 2022
A Swift material design UI module which paints over the parent view when the switch is on.

:octocat: ?? RAMPaperSwitch is a Swift material design UI module which paints over the parent view when the switch is turned on. iOS library by @Ramotion

Ramotion 2.9k Dec 29, 2022