Windless
Windless makes it easy to implement invisible layout loading view.
![]() |
![]() |
![]() |
Contents
Requirements
- iOS 8.0+
- Xcode 9.0+
- Swift 4.0+
Installation
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
CocoaPods 1.1+ is required to build Windless 4.0+.
To integrate Windless into your Xcode project using CocoaPods, specify it in your Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target '<Your Target Name>' do
pod 'Windless', '~> 0.1.2'
end
Then, run the following command:
$ pod install
Carthage
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthage
To integrate Windless into your Xcode project using Carthage, specify it in your Cartfile
:
github "Interactive-Studio/Windless" ~> 0.1.2
Run carthage update
to build the framework and drag the built Windless.framework
into your Xcode project.
Manually
If you prefer not to use either of the aforementioned dependency managers, you can integrate Windless into your project manually.
Usage
Code
import Windless
class ViewController: UIViewController {
lazy var contentsView = UIView()
var subView1 = UIView()
var subView2 = UIView()
override func viewDidLoad() {
super.viewDidLoad()
self.view.addSubview(contentsView)
contentsView.addSubview(subView1)
contentsView.addSubview(subView2)
// start
contentsView.windless
.setupWindlessableViews([subView1, subView2])
.start()
// stop
contentsView.windless.end()
}
}
Storyboard, Xib
If you use Storyboard or xib, you only need to set the isWindlessable
flag to true for the views you want to show as fake in the view inspector of the view, and you do not have to pass the view through the setupWindlessableViews
method.
import Windless
class ViewController: UIViewController {
@IBOutlet weak var contentsView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
contentsView.windless.start()
}
}
Custom Options
There are several customizable options in Windless.
protocol WindlessType {
var direction: WindlessDirection { get set }
var speed: Float { get set }
var beginTime: CFTimeInterval { get set }
var duration: CFTimeInterval { get set }
var pauseDuration: CFTimeInterval { get set }
var timingFuction: CAMediaTimingFunction { get set }
var animationLayerColor: UIColor { get set }
var animationBackgroundColor: UIColor { get set }
var animationLayerOpacity: CGFloat { get set}
var cornerRadius: CGFloat { get set }
}
To set the options, use the apply method as shown below.
import Windless
class ViewController: UIViewController {
@IBOutlet weak var contentsView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
contentsView.windless
.apply {
$0.beginTime = 1
$0.pauseDuration = 2
$0.duration = 3
$0.animationLayerOpacity = 0.5
}
.start()
}
}
If you want to know more detailed usage, please refer to Example.
Credits
- GwangBeom Park (@gwangbeom)
License
Windless is released under the MIT license. See LICENSE for details.