|ReleasedLast Release||May 2016|
Maintained by Sudeep Agarwal.
Focus is a masking view that allows you to focus on or highlight UI elements. It is easy to use and highly customizable - you can call it with a single function call and choose between circular fades and rectangular blurs. Focus is great for tutorials or walkthrough where attention needs to be directed to a certain area of the screen (or even for creating quick screenshots for the App Store).
Focus is available through CocoaPods. To install it, simply add the following line to your Podfile:
And then run:
$ pod install
To manually install Focus, simply add
FocusView.swift to your project.
First, import Focus into your project.
Creating a FocusView is the same as creating a UIView:
let fv = FocusView(frame: self.view.bounds)
Don’t forget to add the subview!
Focus has two styles -
.Blur is a blurred mask with blur style of your choice (
To set the blur style, use
fv.blurStyle = .Dark // default blur style is .Dark
.Fade is a translucent mask with an opacity and color of your choice.
To set the opacity, use
fv.opacity = 0.7 // default opacity is 0.5
To set the color, use
fv.color = UIColor.blackColor() // default color is UIColor.blackColor()
Focus has two types -
.Circle is a round mask around the input view.
.Square is a rectangular mask that fits the frame of the input view.
Focusing on the view is simple.
fv.focusOnView(theView, // the view you want to focus on focusType: .Square, // the type of the focus focusStyle: .Fade, // the style of the focus padding = 10.0) // the padding around the view if you need any
To remove the focus,
Copyright © 2016 Sudeep Agarwal
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.