diff --git a/LeadKit/LeadKit/Classes/Views/XibView.swift b/LeadKit/LeadKit/Classes/Views/XibView.swift index 2bc4d5d2..12e05ebc 100644 --- a/LeadKit/LeadKit/Classes/Views/XibView.swift +++ b/LeadKit/LeadKit/Classes/Views/XibView.swift @@ -45,7 +45,8 @@ open class XibView: UIView { } private func setupView() { - let view: UIView = UIView.loadFromNib(named: innerViewNibName) + let bundle = Bundle(for: type(of: self)) + let view: UIView = UIView.loadFromNib(named: innerViewNibName, bundle: bundle) // Make frame size match the size of the content view in the xib frame = CGRect(origin: frame.origin, size: view.frame.size) diff --git a/LeadKit/LeadKit/Extensions/String/String+Extensions.swift b/LeadKit/LeadKit/Extensions/String/String+Extensions.swift index 1acc434f..2d477290 100644 --- a/LeadKit/LeadKit/Extensions/String/String+Extensions.swift +++ b/LeadKit/LeadKit/Extensions/String/String+Extensions.swift @@ -24,6 +24,11 @@ import UIKit public extension String { + /** + method returns image with self name + + - returns: image + */ public var image: UIImage? { return UIImage(named: self) } diff --git a/LeadKit/LeadKit/Extensions/TableDirector/TableDirector+Extensions.swift b/LeadKit/LeadKit/Extensions/TableDirector/TableDirector+Extensions.swift index 097dcd7c..c108c618 100644 --- a/LeadKit/LeadKit/Extensions/TableDirector/TableDirector+Extensions.swift +++ b/LeadKit/LeadKit/Extensions/TableDirector/TableDirector+Extensions.swift @@ -24,6 +24,15 @@ import TableKit public extension TableDirector { + /** + method replaces current table director's section at index and reloads it + + - parameter section: new section + - parameter index: current replaced section index + - parameter reload: is reloaded after replace + + - returns: self + */ @discardableResult public func replace(section: TableSection, atIndex index: Int, reload: Bool = true) -> Self { if index < sections.count { @@ -36,6 +45,14 @@ public extension TableDirector { return self } + /** + method reloads section at index with animation + + - parameter index: current reloaded section index + - parameter animation: reloading animation. Default .none + + - returns: self + */ @discardableResult public func reload(sectionAtIndex index: Int, with animation: UITableViewRowAnimation = .none) -> Self { let action = { [tableView] in @@ -53,17 +70,38 @@ public extension TableDirector { return self } + /** + method replaces current table director's state with sections + + - parameter sections: new sections + + - returns: self + */ @discardableResult public func replace(withSections sections: [TableSection]) -> Self { clear().append(sections: sections).reload() return self } + /** + method replaces current table director's state with section + + - parameter section: new section + + - returns: self + */ @discardableResult public func replace(withSection section: TableSection) -> Self { return replace(withSections: [section]) } + /** + method replaces current table director's state with rows + + - parameter rows: new rows + + - returns: self + */ @discardableResult public func replace(withRows rows: [Row]) -> Self { return replace(withSection: TableSection(rows: rows)) diff --git a/LeadKit/LeadKit/Extensions/UIApplication/UIApplication+Extensions.swift b/LeadKit/LeadKit/Extensions/UIApplication/UIApplication+Extensions.swift index ee1b27ea..637d3cba 100644 --- a/LeadKit/LeadKit/Extensions/UIApplication/UIApplication+Extensions.swift +++ b/LeadKit/LeadKit/Extensions/UIApplication/UIApplication+Extensions.swift @@ -24,9 +24,18 @@ import UIKit public extension UIApplication { + /// default scale static let snapshotScale: CGFloat = 1.5 + /// default root controller animation duration static let snapshotAnimationDuration = 0.5 + /** + static method changes root controller in window and sets status bar style + + - parameter controller: new root controller + - parameter statusBarStyle: new status bar style + - parameter appWindow: application window + */ public static func changeRootController(controller: UIViewController, statusBarStyle: UIStatusBarStyle, appWindow: UIWindow?) { @@ -42,6 +51,12 @@ public extension UIApplication { UIApplication.shared.statusBarStyle = statusBarStyle } + /** + static method animates changing root controller + + - parameter controller: new root controller + - parameter window: current window + */ private static func animateRootViewControllerChanging(controller: UIViewController, window: UIWindow) { if let snapshot = window.snapshotView(afterScreenUpdates: true) {