Commit e4e0ffd7 by Daniel Dahan

development: added SnackbarController example to programmatic

parent 0f0e74f8
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
<FileRef <FileRef
location = "group:Programmatic/NavigationController/NavigationController.xcodeproj"> location = "group:Programmatic/NavigationController/NavigationController.xcodeproj">
</FileRef> </FileRef>
<FileRef
location = "group:Programmatic/Snackbar/Snackbar.xcodeproj">
</FileRef>
</Group> </Group>
<Group <Group
location = "container:" location = "container:"
......
...@@ -113,7 +113,6 @@ ...@@ -113,7 +113,6 @@
TargetAttributes = { TargetAttributes = {
96CC49C81D8DD984002CAB55 = { 96CC49C81D8DD984002CAB55 = {
CreatedOnToolsVersion = 8.0; CreatedOnToolsVersion = 8.0;
DevelopmentTeam = 9Z76XCNLGL;
ProvisioningStyle = Automatic; ProvisioningStyle = Automatic;
}; };
}; };
...@@ -271,7 +270,7 @@ ...@@ -271,7 +270,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 9Z76XCNLGL; DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = NavigationController/Info.plist; INFOPLIST_FILE = NavigationController/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.NavigationController; PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.NavigationController;
...@@ -284,7 +283,7 @@ ...@@ -284,7 +283,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 9Z76XCNLGL; DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = NavigationController/Info.plist; INFOPLIST_FILE = NavigationController/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.NavigationController; PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.NavigationController;
......
...@@ -37,7 +37,7 @@ class RootViewController: UIViewController { ...@@ -37,7 +37,7 @@ class RootViewController: UIViewController {
private var starButton: IconButton! private var starButton: IconButton!
private var searchButton: IconButton! private var searchButton: IconButton!
/// Trigger to go to next view controller. /// Trigger to go to the next view controller.
private var nextButton: FlatButton! private var nextButton: FlatButton!
override func viewDidLoad() { override func viewDidLoad() {
......
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:Snackbar.xcodeproj">
</FileRef>
</Workspace>
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
import Material
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func applicationDidFinishLaunching(_ application: UIApplication) {
window = UIWindow(frame: Device.bounds)
window!.rootViewController = AppSnackbarController(rootViewController: RootViewController())
window!.makeKeyAndVisible()
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
import Material
class AppSnackbarController: SnackbarController {
open override func prepare() {
super.prepare()
delegate = self
}
}
extension AppSnackbarController: SnackbarControllerDelegate {
func snackbarControllerWillShow(snackbarController: SnackbarController) {
print("snackbarControllerWillShow")
}
func snackbarControllerWillHide(snackbarController: SnackbarController) {
print("snackbarControllerWillHide")
}
func snackbarControllerDidShow(snackbarController: SnackbarController) {
print("snackbarControllerDidShow")
}
func snackbarControllerDidHide(snackbarController: SnackbarController) {
print("snackbarControllerDidHide")
}
}
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
import Material
class RootViewController: UIViewController {
/// A reference to the Undo button.
private var undoButton: FlatButton!
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = Color.lightBlue.base
prepareUndoButton()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
prepareSnackbar()
animateSnackbar()
}
private func prepareUndoButton() {
undoButton = FlatButton(title: "Undo", titleColor: Color.yellow.base)
undoButton.pulseColor = Color.white
}
private func prepareSnackbar() {
snackbarController?.snackbar.text = "Message saved."
snackbarController?.snackbar.rightViews = [undoButton]
}
private func animateSnackbar() {
_ = snackbarController?.animate(snackbar: .visible, delay: 1)
_ = snackbarController?.animate(snackbar: .hidden, delay: 4)
}
}
...@@ -60,7 +60,7 @@ public typealias AnimationDelayCancelBlock = (Bool) -> Void ...@@ -60,7 +60,7 @@ public typealias AnimationDelayCancelBlock = (Bool) -> Void
public struct Animation { public struct Animation {
/// Delay helper method. /// Delay helper method.
@discardableResult @discardableResult
public static func delay(time: TimeInterval, completion: @escaping () -> Void) -> AnimationDelayCancelBlock? { public static func delay(time: TimeInterval, completion: @escaping () -> Void) -> AnimationDelayCancelBlock? {
func asyncAfter(completion: @escaping () -> Void) { func asyncAfter(completion: @escaping () -> Void) {
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + time, execute: completion) DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + time, execute: completion)
......
...@@ -54,11 +54,11 @@ open class BarView: ContentView { ...@@ -54,11 +54,11 @@ open class BarView: ContentView {
/** /**
A convenience initializer with parameter settings. A convenience initializer with parameter settings.
- Parameter leftControls: An Array of UIControls that go on the left side. - Parameter leftViews: An Array of UIViews that go on the left side.
- Parameter rightControls: An Array of UIControls that go on the right side. - Parameter rightViews: An Array of UIViews that go on the right side.
*/ */
public override init(leftControls: [UIView]? = nil, rightControls: [UIView]? = nil) { public override init(leftViews: [UIView]? = nil, rightViews: [UIView]? = nil) {
super.init(leftControls: leftControls, rightControls: rightControls) super.init(leftViews: leftViews, rightViews: rightViews)
} }
open override func layoutSubviews() { open override func layoutSubviews() {
......
...@@ -104,8 +104,8 @@ open class ContentView: View { ...@@ -104,8 +104,8 @@ open class ContentView: View {
/// ContentView that holds the any desired subviews. /// ContentView that holds the any desired subviews.
open private(set) lazy var contentView = View() open private(set) lazy var contentView = View()
/// Left side UIControls. /// Left side UIViews.
open var leftControls = [UIView]() { open var leftViews = [UIView]() {
didSet { didSet {
for v in oldValue { for v in oldValue {
v.removeFromSuperview() v.removeFromSuperview()
...@@ -114,8 +114,8 @@ open class ContentView: View { ...@@ -114,8 +114,8 @@ open class ContentView: View {
} }
} }
/// Right side UIControls. /// Right side UIViews.
open var rightControls = [UIView]() { open var rightViews = [UIView]() {
didSet { didSet {
for v in oldValue { for v in oldValue {
v.removeFromSuperview() v.removeFromSuperview()
...@@ -150,12 +150,12 @@ open class ContentView: View { ...@@ -150,12 +150,12 @@ open class ContentView: View {
/** /**
A convenience initializer with parameter settings. A convenience initializer with parameter settings.
- Parameter leftControls: An Array of UIControls that go on the left side. - Parameter leftViews: An Array of UIViews that go on the left side.
- Parameter rightControls: An Array of UIControls that go on the right side. - Parameter rightViews: An Array of UIViews that go on the right side.
*/ */
public init(leftControls: [UIView]? = nil, rightControls: [UIView]? = nil) { public init(leftViews: [UIView]? = nil, rightViews: [UIView]? = nil) {
self.leftControls = leftControls ?? [] self.leftViews = leftViews ?? []
self.rightControls = rightControls ?? [] self.rightViews = rightViews ?? []
super.init(frame: .zero) super.init(frame: .zero)
frame.size = intrinsicContentSize frame.size = intrinsicContentSize
} }
...@@ -168,8 +168,8 @@ open class ContentView: View { ...@@ -168,8 +168,8 @@ open class ContentView: View {
var lc = 0 var lc = 0
var rc = 0 var rc = 0
let l = (CGFloat(leftControls.count) * interimSpace) let l = (CGFloat(leftViews.count) * interimSpace)
let r = (CGFloat(rightControls.count) * interimSpace) let r = (CGFloat(rightViews.count) * interimSpace)
let p = width - l - r - contentEdgeInsets.left - contentEdgeInsets.right let p = width - l - r - contentEdgeInsets.left - contentEdgeInsets.right
let columns = Int(ceil(p / gridFactor)) let columns = Int(ceil(p / gridFactor))
...@@ -177,7 +177,7 @@ open class ContentView: View { ...@@ -177,7 +177,7 @@ open class ContentView: View {
grid.views.removeAll() grid.views.removeAll()
grid.axis.columns = columns grid.axis.columns = columns
for v in leftControls { for v in leftViews {
(v as? UIButton)?.contentEdgeInsets = .zero (v as? UIButton)?.contentEdgeInsets = .zero
v.sizeToFit() v.sizeToFit()
v.grid.columns = Int(ceil(v.width / gridFactor)) + 1 v.grid.columns = Int(ceil(v.width / gridFactor)) + 1
...@@ -189,7 +189,7 @@ open class ContentView: View { ...@@ -189,7 +189,7 @@ open class ContentView: View {
grid.views.append(contentView) grid.views.append(contentView)
for v in rightControls { for v in rightViews {
(v as? UIButton)?.contentEdgeInsets = .zero (v as? UIButton)?.contentEdgeInsets = .zero
v.sizeToFit() v.sizeToFit()
v.grid.columns = Int(ceil(v.width / gridFactor)) + 1 v.grid.columns = Int(ceil(v.width / gridFactor)) + 1
...@@ -207,7 +207,7 @@ open class ContentView: View { ...@@ -207,7 +207,7 @@ open class ContentView: View {
contentView.grid.offset.columns = rc - lc contentView.grid.offset.columns = rc - lc
} else { } else {
contentView.grid.columns = columns - 2 * lc contentView.grid.columns = columns - 2 * lc
rightControls.first?.grid.offset.columns = lc - rc rightViews.first?.grid.offset.columns = lc - rc
} }
} else { } else {
contentView.grid.columns = columns - lc - rc contentView.grid.columns = columns - lc - rc
......
...@@ -101,39 +101,39 @@ open class SearchBar: BarView { ...@@ -101,39 +101,39 @@ open class SearchBar: BarView {
} }
/** /**
An initializer that initializes the object with a NSCoder object. An initializer that initializes the object with a NSCoder object.
- Parameter aDecoder: A NSCoder instance. - Parameter aDecoder: A NSCoder instance.
*/ */
public required init?(coder aDecoder: NSCoder) { public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder) super.init(coder: aDecoder)
} }
/** /**
An initializer that initializes the object with a CGRect object. An initializer that initializes the object with a CGRect object.
If AutoLayout is used, it is better to initilize the instance If AutoLayout is used, it is better to initilize the instance
using the init() initializer. using the init() initializer.
- Parameter frame: A CGRect instance. - Parameter frame: A CGRect instance.
*/ */
public override init(frame: CGRect) { public override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
} }
/** /**
A convenience initializer with parameter settings. A convenience initializer with parameter settings.
- Parameter leftControls: An Array of UIControls that go on the left side. - Parameter leftViews: An Array of UIViews that go on the left side.
- Parameter rightControls: An Array of UIControls that go on the right side. - Parameter rightViews: An Array of UIViews that go on the right side.
*/ */
public override init(leftControls: [UIView]? = nil, rightControls: [UIView]? = nil) { public override init(leftViews: [UIView]? = nil, rightViews: [UIView]? = nil) {
super.init(leftControls: leftControls, rightControls: rightControls) super.init(leftViews: leftViews, rightViews: rightViews)
} }
/** /**
Prepares the view instance when intialized. When subclassing, Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepare method it is recommended to override the prepare method
to initialize property values and other setup operations. to initialize property values and other setup operations.
The super.prepare method should always be called immediately The super.prepare method should always be called immediately
when subclassing. when subclassing.
*/ */
open override func prepare() { open override func prepare() {
super.prepare() super.prepare()
interimSpacePreset = .interimSpace3 interimSpacePreset = .interimSpace3
......
...@@ -102,6 +102,7 @@ open class SnackbarController: RootController { ...@@ -102,6 +102,7 @@ open class SnackbarController: RootController {
Animates to a SnackbarStatus. Animates to a SnackbarStatus.
- Parameter status: A SnackbarStatus enum value. - Parameter status: A SnackbarStatus enum value.
*/ */
@discardableResult
open func animate(snackbar status: SnackbarStatus, delay: TimeInterval = 0, animations: ((Snackbar) -> Void)? = nil, completion: ((Snackbar) -> Void)? = nil) -> AnimationDelayCancelBlock? { open func animate(snackbar status: SnackbarStatus, delay: TimeInterval = 0, animations: ((Snackbar) -> Void)? = nil, completion: ((Snackbar) -> Void)? = nil) -> AnimationDelayCancelBlock? {
return Animation.delay(time: delay) { [weak self, status = status, animations = animations, completion = completion] in return Animation.delay(time: delay) { [weak self, status = status, animations = animations, completion = completion] in
guard let s = self else { guard let s = self else {
......
...@@ -85,11 +85,11 @@ open class Toolbar: BarView { ...@@ -85,11 +85,11 @@ open class Toolbar: BarView {
/** /**
A convenience initializer with parameter settings. A convenience initializer with parameter settings.
- Parameter leftControls: An Array of UIControls that go on the left side. - Parameter leftViews: An Array of UIViews that go on the left side.
- Parameter rightControls: An Array of UIControls that go on the right side. - Parameter rightViews: An Array of UIViews that go on the right side.
*/ */
public override init(leftControls: [UIView]? = nil, rightControls: [UIView]? = nil) { public override init(leftViews: [UIView]? = nil, rightViews: [UIView]? = nil) {
super.init(leftControls: leftControls, rightControls: rightControls) super.init(leftViews: leftViews, rightViews: rightViews)
} }
open override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) { open override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment