diff --git a/LeadKit.podspec b/LeadKit.podspec index 6c31f669..2cba232c 100644 --- a/LeadKit.podspec +++ b/LeadKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "LeadKit" - s.version = "0.5.13" + s.version = "0.5.14" s.summary = "iOS framework with a bunch of tools for rapid development" s.homepage = "https://github.com/TouchInstinct/LeadKit" s.license = "Apache License, Version 2.0" diff --git a/Sources/Extensions/CGContext/CGContext+Initializers.swift b/Sources/Extensions/CGContext/CGContext+Initializers.swift index 4730ff15..6ce1352d 100644 --- a/Sources/Extensions/CGContext/CGContext+Initializers.swift +++ b/Sources/Extensions/CGContext/CGContext+Initializers.swift @@ -39,8 +39,8 @@ public extension CGContext { /// - cgImage: CGImage instance from which the parameters will be taken. /// - fallbackColorSpace: Fallback color space if image doesn't have it. /// - Returns: A new bitmap context, or NULL if a context could not be created. - public static func create(forCGImage cgImage: CGImage, - fallbackColorSpace: CGColorSpace = CGColorSpaceCreateDeviceRGB()) -> CGContext? { + static func create(forCGImage cgImage: CGImage, + fallbackColorSpace: CGColorSpace = CGColorSpaceCreateDeviceRGB()) -> CGContext? { return create(width: cgImage.width, height: cgImage.height, @@ -60,11 +60,11 @@ public extension CGContext { /// - colorSpace: The color space to use for the bitmap context. /// - bitsPerComponent: The number of bits to use for each component of a pixel in memory. /// - Returns: A new bitmap context, or NULL if a context could not be created. - public static func create(width: Int, - height: Int, - bitmapInfo: CGBitmapInfo = .alphaBitmapInfo, - colorSpace: CGColorSpace = CGColorSpaceCreateDeviceRGB(), - bitsPerComponent: Int = 8) -> CGContext? { + static func create(width: Int, + height: Int, + bitmapInfo: CGBitmapInfo = .alphaBitmapInfo, + colorSpace: CGColorSpace = CGColorSpaceCreateDeviceRGB(), + bitsPerComponent: Int = 8) -> CGContext? { return CGContext(data: nil, width: width, diff --git a/Sources/Extensions/CGImage/CGImage+Alpha.swift b/Sources/Extensions/CGImage/CGImage+Alpha.swift index a17cdf6e..dccfd0cd 100644 --- a/Sources/Extensions/CGImage/CGImage+Alpha.swift +++ b/Sources/Extensions/CGImage/CGImage+Alpha.swift @@ -25,7 +25,7 @@ import CoreGraphics public extension CGImage { /// A Boolean value indicating whether the image data has an alpha channel. - public var hasAlpha: Bool { + var hasAlpha: Bool { switch alphaInfo { case .first, .last, .premultipliedFirst, .premultipliedLast: return true diff --git a/Sources/Extensions/CGImage/CGImage+Crop.swift b/Sources/Extensions/CGImage/CGImage+Crop.swift index 2ebffa4c..1a980769 100644 --- a/Sources/Extensions/CGImage/CGImage+Crop.swift +++ b/Sources/Extensions/CGImage/CGImage+Crop.swift @@ -27,7 +27,7 @@ public extension CGImage { /// Crop image to square from center. /// /// - Returns: A new cropped image or nil if something goes wrong. - public func cropFromCenterToSquare() -> CGImage? { + func cropFromCenterToSquare() -> CGImage? { let shortest = min(width, height) let widthCropSize = width > shortest ? (width - shortest) : 0 @@ -52,10 +52,10 @@ public extension CGImage { /// - bottom: Bottom margin. /// - right: Right margin. /// - Returns: A new CGImage cropped with given paddings or nil if something goes wrong. - public func crop(top: CGFloat = 0, - left: CGFloat = 0, - bottom: CGFloat = 0, - right: CGFloat = 0) -> CGImage? { + func crop(top: CGFloat = 0, + left: CGFloat = 0, + bottom: CGFloat = 0, + right: CGFloat = 0) -> CGImage? { let rect = CGRect(x: left, y: top, diff --git a/Sources/Extensions/CGSize/CGSize+Resize.swift b/Sources/Extensions/CGSize/CGSize+Resize.swift index 84f7909c..5e7f3ab9 100644 --- a/Sources/Extensions/CGSize/CGSize+Resize.swift +++ b/Sources/Extensions/CGSize/CGSize+Resize.swift @@ -30,7 +30,7 @@ public extension CGSize { /// - newSize: Requested new size. /// - resizeMode: Resize mode to use. /// - Returns: A new CGRect instance matching request parameters. - public func resizeRect(forNewSize newSize: CGSize, resizeMode: ResizeMode) -> CGRect { + func resizeRect(forNewSize newSize: CGSize, resizeMode: ResizeMode) -> CGRect { let horizontalRatio = newSize.width / width let verticalRatio = newSize.height / height diff --git a/Sources/Extensions/Double/Double+Rounding.swift b/Sources/Extensions/Double/Double+Rounding.swift index 6564cc56..09a406ad 100644 --- a/Sources/Extensions/Double/Double+Rounding.swift +++ b/Sources/Extensions/Double/Double+Rounding.swift @@ -30,7 +30,7 @@ public extension Double { - Normal: From 167.567 you will get 167.6 - Down: From 167.567 you will get 167.5 */ - public enum RoundingType { + enum RoundingType { case normal case down } @@ -43,8 +43,8 @@ public extension Double { - returns: rounded value */ - public func roundValue(withPersicion persicion: UInt, - roundType: RoundingType = .normal) -> Double { + func roundValue(withPersicion persicion: UInt, + roundType: RoundingType = .normal) -> Double { let divider = pow(10.0, Double(persicion)) switch roundType { diff --git a/Sources/Extensions/NetworkService/NetworkService+RxLoadImage.swift b/Sources/Extensions/NetworkService/NetworkService+RxLoadImage.swift index 23b9b0db..cc444793 100644 --- a/Sources/Extensions/NetworkService/NetworkService+RxLoadImage.swift +++ b/Sources/Extensions/NetworkService/NetworkService+RxLoadImage.swift @@ -29,7 +29,7 @@ public extension NetworkService { /// /// - Parameter url: An object adopting `URLConvertible` /// - Returns: Observable of tuple containing (HTTPURLResponse, UIImage?) - public func rxLoadImage(url: String) -> Observable<(HTTPURLResponse, UIImage?)> { + func rxLoadImage(url: String) -> Observable<(HTTPURLResponse, UIImage?)> { let request = RxAlamofire.requestData(.get, url, headers: [:]) return request diff --git a/Sources/Extensions/StoryboardProtocol/StoryboardProtocol+DefaultBundle.swift b/Sources/Extensions/StoryboardProtocol/StoryboardProtocol+DefaultBundle.swift index 6846b958..ecb9b7c3 100644 --- a/Sources/Extensions/StoryboardProtocol/StoryboardProtocol+DefaultBundle.swift +++ b/Sources/Extensions/StoryboardProtocol/StoryboardProtocol+DefaultBundle.swift @@ -27,7 +27,7 @@ public extension StoryboardProtocol { /** - returns: default bundle for storyboard initialization */ - public static var bundle: Bundle? { + static var bundle: Bundle? { return Bundle.main } diff --git a/Sources/Extensions/StoryboardProtocol/StoryboardProtocol+Extensions.swift b/Sources/Extensions/StoryboardProtocol/StoryboardProtocol+Extensions.swift index 523e664d..dc2d033e 100644 --- a/Sources/Extensions/StoryboardProtocol/StoryboardProtocol+Extensions.swift +++ b/Sources/Extensions/StoryboardProtocol/StoryboardProtocol+Extensions.swift @@ -29,7 +29,7 @@ ViewControllerIdentifier: RawRepresentable, ViewControllerIdentifier.RawValue == /** - returns: UIStoryboradInstance with StoryboardIdentifier name */ - public static var uiStoryboard: UIStoryboard { + static var uiStoryboard: UIStoryboard { return UIStoryboard(name: storyboardIdentifier.rawValue, bundle: bundle) } @@ -40,7 +40,7 @@ ViewControllerIdentifier: RawRepresentable, ViewControllerIdentifier.RawValue == - returns: UIViewController instance */ - public static func instantiateViewController(_ viewController: ViewControllerIdentifier) -> UIViewController { + static func instantiateViewController(_ viewController: ViewControllerIdentifier) -> UIViewController { return uiStoryboard.instantiateViewController(withIdentifier: viewController.rawValue) } diff --git a/Sources/Extensions/String/String+Extensions.swift b/Sources/Extensions/String/String+Extensions.swift index 2d06fa31..4803d67a 100644 --- a/Sources/Extensions/String/String+Extensions.swift +++ b/Sources/Extensions/String/String+Extensions.swift @@ -29,7 +29,7 @@ public extension String { - returns: image */ - public var image: UIImage? { + var image: UIImage? { return UIImage(named: self) } @@ -38,7 +38,7 @@ public extension String { - returns: nil if string empty, self otherwise */ - public var nilIfEmpty: String? { + var nilIfEmpty: String? { return isEmpty ? nil : self } diff --git a/Sources/Extensions/String/String+Localization.swift b/Sources/Extensions/String/String+Localization.swift index 6eefbcf0..d43c09e3 100644 --- a/Sources/Extensions/String/String+Localization.swift +++ b/Sources/Extensions/String/String+Localization.swift @@ -29,7 +29,7 @@ public extension String { - returns: localized string */ - public func localized() -> String { + func localized() -> String { return NSLocalizedString(self, comment: "") } diff --git a/Sources/Extensions/String/String+SizeCalculation.swift b/Sources/Extensions/String/String+SizeCalculation.swift index 5e197d88..7bda846d 100644 --- a/Sources/Extensions/String/String+SizeCalculation.swift +++ b/Sources/Extensions/String/String+SizeCalculation.swift @@ -34,11 +34,11 @@ public struct StringSizeCalculationResult { public extension StringSizeCalculationResult { - public var height: CGFloat { return size.height } + var height: CGFloat { return size.height } - public var width: CGFloat { return size.width } + var width: CGFloat { return size.width } - public var numberOfLines: UInt? { + var numberOfLines: UInt? { if let lineHeight = fontLineHeight { let lineHeightRounded = Double(lineHeight).roundValue(withPersicion: 2) @@ -65,9 +65,9 @@ public extension String { - returns: string size calculation result */ - public func size(withAttributes attributes: [String: AnyObject]?, - maxWidth: CGFloat = CGFloat.greatestFiniteMagnitude, - maxHeight: CGFloat = CGFloat.greatestFiniteMagnitude) -> StringSizeCalculationResult { + func size(withAttributes attributes: [String: AnyObject]?, + maxWidth: CGFloat = CGFloat.greatestFiniteMagnitude, + maxHeight: CGFloat = CGFloat.greatestFiniteMagnitude) -> StringSizeCalculationResult { let size = self.boundingRect(with: CGSize(width: maxWidth, height: maxHeight), options: [.usesLineFragmentOrigin, .usesFontLeading], diff --git a/Sources/Extensions/Support/UIScrollView+Support.swift b/Sources/Extensions/Support/UIScrollView+Support.swift index aac2cdc3..e1b3339a 100644 --- a/Sources/Extensions/Support/UIScrollView+Support.swift +++ b/Sources/Extensions/Support/UIScrollView+Support.swift @@ -24,7 +24,7 @@ import UIKit public extension Support where Base: UIScrollView { - public var refreshControl: UIRefreshControl? { + var refreshControl: UIRefreshControl? { if #available(iOS 10.0, *) { return base.refreshControl } else { @@ -32,7 +32,7 @@ public extension Support where Base: UIScrollView { } } - public func setRefreshControl(_ newRefreshControl: UIRefreshControl?) { + func setRefreshControl(_ newRefreshControl: UIRefreshControl?) { if #available(iOS 10.0, *) { base.refreshControl = newRefreshControl } else { diff --git a/Sources/Extensions/TableDirector/TableDirector+Extensions.swift b/Sources/Extensions/TableDirector/TableDirector+Extensions.swift index bc00d2aa..d5f39c18 100644 --- a/Sources/Extensions/TableDirector/TableDirector+Extensions.swift +++ b/Sources/Extensions/TableDirector/TableDirector+Extensions.swift @@ -34,7 +34,7 @@ public extension TableDirector { - returns: self */ @discardableResult - public func replace(section: TableSection, atIndex index: Int, reload: Bool = true) -> Self { + func replace(section: TableSection, atIndex index: Int, reload: Bool = true) -> Self { if index < sections.count { remove(sectionAt: index) } @@ -54,7 +54,7 @@ public extension TableDirector { - returns: self */ @discardableResult - public func reload(sectionAtIndex index: Int, with animation: UITableViewRowAnimation = .none) -> Self { + func reload(sectionAtIndex index: Int, with animation: UITableViewRowAnimation = .none) -> Self { let action = { [tableView] in guard let tableView = tableView else { return @@ -82,7 +82,7 @@ public extension TableDirector { - returns: self */ @discardableResult - public func replace(withSections sections: [TableSection]) -> Self { + func replace(withSections sections: [TableSection]) -> Self { clear().append(sections: sections).reload() return self } @@ -95,7 +95,7 @@ public extension TableDirector { - returns: self */ @discardableResult - public func replace(withSection section: TableSection) -> Self { + func replace(withSection section: TableSection) -> Self { return replace(withSections: [section]) } @@ -107,7 +107,7 @@ public extension TableDirector { - returns: self */ @discardableResult - public func replace(withRows rows: [Row]) -> Self { + func replace(withRows rows: [Row]) -> Self { return replace(withSection: TableSection(rows: rows)) } diff --git a/Sources/Extensions/TableDirector/TableRow+Extensions.swift b/Sources/Extensions/TableDirector/TableRow+Extensions.swift index 6d83ca6a..9b8db3d5 100644 --- a/Sources/Extensions/TableDirector/TableRow+Extensions.swift +++ b/Sources/Extensions/TableDirector/TableRow+Extensions.swift @@ -38,7 +38,7 @@ public extension TableRow where CellType.T: SeparatorCellViewModel { public extension TableRow where CellType: SeparatorCell, CellType.T: SeparatorCellViewModel { /// TableRow typed as SeparatorRowBox - public var separatorRowBox: SeparatorRowBox { + var separatorRowBox: SeparatorRowBox { return SeparatorRowBox(tableRow: self) } diff --git a/Sources/Extensions/UICollectionView/UICollectionView+CellRegistration.swift b/Sources/Extensions/UICollectionView/UICollectionView+CellRegistration.swift index 0ff6ecb1..29ee4261 100644 --- a/Sources/Extensions/UICollectionView/UICollectionView+CellRegistration.swift +++ b/Sources/Extensions/UICollectionView/UICollectionView+CellRegistration.swift @@ -33,7 +33,7 @@ public extension UICollectionView { /// ReuseIdentifierProtocol and StaticNibNameProtocol /// - bundle: The bundle in which to search for the nib file. /// If you specify nil, this method looks for the nib file in the main bundle. - public func registerNib(forCellClass cellClass: T.Type, bundle: Bundle? = nil) + func registerNib(forCellClass cellClass: T.Type, bundle: Bundle? = nil) where T: ReuseIdentifierProtocol, T: UICollectionViewCell, T: XibNameProtocol { register(UINib(nibName: T.xibName, bundle: bundle), forCellWithReuseIdentifier: T.reuseIdentifier) diff --git a/Sources/Extensions/UIColor/UIColor+Hex.swift b/Sources/Extensions/UIColor/UIColor+Hex.swift index b9e92cd0..ac3bd679 100644 --- a/Sources/Extensions/UIColor/UIColor+Hex.swift +++ b/Sources/Extensions/UIColor/UIColor+Hex.swift @@ -31,7 +31,7 @@ public extension UIColor { - parameter hex3: Three-digit hexadecimal value. - parameter alpha: 0.0 - 1.0. The default is 1.0. */ - public convenience init(hex3: UInt16, alpha: CGFloat = 1) { + convenience init(hex3: UInt16, alpha: CGFloat = 1) { let red = CGFloat((hex3 & 0xF00) >> 8) / 0xF let green = CGFloat((hex3 & 0x0F0) >> 4) / 0xF let blue = CGFloat((hex3 & 0x00F) >> 0) / 0xF @@ -44,7 +44,7 @@ public extension UIColor { - parameter hex4: Four-digit hexadecimal value. */ - public convenience init(hex4: UInt16) { + convenience init(hex4: UInt16) { let red = CGFloat((hex4 & 0xF000) >> 12) / 0xF let green = CGFloat((hex4 & 0x0F00) >> 8) / 0xF let blue = CGFloat((hex4 & 0x00F0) >> 4) / 0xF @@ -59,7 +59,7 @@ public extension UIColor { - parameter hex6: Six-digit hexadecimal value. - parameter alpha: alpha: 0.0 - 1.0. The default is 1.0. */ - public convenience init(hex6: UInt32, alpha: CGFloat = 1) { + convenience init(hex6: UInt32, alpha: CGFloat = 1) { let red = CGFloat((hex6 & 0xFF0000) >> 16) / 0xFF let green = CGFloat((hex6 & 0x00FF00) >> 8) / 0xFF let blue = CGFloat((hex6 & 0x0000FF) >> 0) / 0xFF @@ -72,7 +72,7 @@ public extension UIColor { - parameter hex8: Eight-digit hexadecimal value. */ - public convenience init(hex8: UInt32) { + convenience init(hex8: UInt32) { let red = CGFloat((hex8 & 0xFF000000) >> 24) / 0xFF let green = CGFloat((hex8 & 0x00FF0000) >> 16) / 0xFF let blue = CGFloat((hex8 & 0x0000FF00) >> 8) / 0xFF @@ -87,7 +87,7 @@ public extension UIColor { - parameter hexString: hex string with red green and blue values (can have `#` sign) - parameter alpha: alpha component used if not given in hexString */ - public convenience init?(hexString: String, alpha: CGFloat = 1) { + convenience init?(hexString: String, alpha: CGFloat = 1) { let hexStr: String if hexString.hasPrefix("#") { diff --git a/Sources/Extensions/UIDevice/UIDevice+Extensions.swift b/Sources/Extensions/UIDevice/UIDevice+Extensions.swift index 15e762ef..3265dfce 100644 --- a/Sources/Extensions/UIDevice/UIDevice+Extensions.swift +++ b/Sources/Extensions/UIDevice/UIDevice+Extensions.swift @@ -25,7 +25,7 @@ import UIKit public extension UIDevice { /// Returns true if the current device is simulator - public static var isSimulator: Bool { + static var isSimulator: Bool { return ProcessInfo.processInfo.environment["SIMULATOR_DEVICE_NAME"] != nil } diff --git a/Sources/Extensions/UIImage/UIImage+Extensions.swift b/Sources/Extensions/UIImage/UIImage+Extensions.swift index e4db42f4..73204065 100644 --- a/Sources/Extensions/UIImage/UIImage+Extensions.swift +++ b/Sources/Extensions/UIImage/UIImage+Extensions.swift @@ -32,7 +32,7 @@ public extension UIImage { /// - size: The size of an new image. /// - scale: The scale of image. /// - Returns: A new instanse of UIImage with given size and color. - public static func imageWith(color: UIColor, size: CGSize) -> UIImage { + static func imageWith(color: UIColor, size: CGSize) -> UIImage { let width = Int(ceil(size.width)) let height = Int(ceil(size.height)) @@ -45,7 +45,7 @@ public extension UIImage { /// /// - Parameter fromView: The source view. /// - Returns: A new instance of UIImage or nil if something goes wrong. - public static func imageFrom(view: UIView) -> UIImage { + static func imageFrom(view: UIView) -> UIImage { let operation = CALayerDrawingOperation(layer: view.layer, size: view.bounds.size) return operation.imageFromNewRenderer(scale: UIScreen.main.scale) @@ -55,7 +55,7 @@ public extension UIImage { /// /// - Parameter color: Color to fill template image. /// - Returns: A new UIImage rendered with given color. - public func renderTemplate(withColor color: UIColor) -> UIImage { + func renderTemplate(withColor color: UIColor) -> UIImage { guard let image = cgImage else { return self } @@ -75,10 +75,10 @@ public extension UIImage { /// - color: The color of the border. /// - extendSize: Extend result image size and don't overlap source image by border. /// - Returns: A new image with rounded corners. - public func roundCorners(cornerRadius: CGFloat, - borderWidth: CGFloat, - color: UIColor, - extendSize: Bool = false) -> UIImage { + func roundCorners(cornerRadius: CGFloat, + borderWidth: CGFloat, + color: UIColor, + extendSize: Bool = false) -> UIImage { guard let image = cgImage else { return self @@ -105,7 +105,7 @@ public extension UIImage { /// Creates a new circle image. /// /// - Returns: A new circled image. - public func roundCornersToCircle() -> UIImage { + func roundCornersToCircle() -> UIImage { guard let image = cgImage else { return self } @@ -126,9 +126,9 @@ public extension UIImage { /// - borderColor: The color of the border. /// - extendSize: Extend result image size and don't overlap source image by border (default = false). /// - Returns: A new image with rounded corners or nil if something goes wrong. - public func roundCornersToCircle(borderWidth: CGFloat, - borderColor: UIColor, - extendSize: Bool = false) -> UIImage { + func roundCornersToCircle(borderWidth: CGFloat, + borderColor: UIColor, + extendSize: Bool = false) -> UIImage { guard let image = cgImage else { return self @@ -162,9 +162,9 @@ public extension UIImage { /// - cropToImageBounds: Should output image size match resized image size. /// Note: If passed true with ResizeMode.scaleAspectFit content mode it will give the original image. /// - Returns: A new image scaled to new size. - public func resize(newSize: CGSize, - contentMode: ResizeMode = .scaleToFill, - cropToImageBounds: Bool = false) -> UIImage { + func resize(newSize: CGSize, + contentMode: ResizeMode = .scaleToFill, + cropToImageBounds: Bool = false) -> UIImage { guard let image = cgImage else { return self @@ -182,7 +182,7 @@ public extension UIImage { /// Adds an alpha channel if UIImage doesn't already have one. /// /// - Returns: A copy of the given image, adding an alpha channel if it doesn't already have one. - public func applyAlpha() -> UIImage { + func applyAlpha() -> UIImage { guard let image = cgImage, !image.hasAlpha else { return self } @@ -198,7 +198,7 @@ public extension UIImage { /// /// - Parameter padding: The padding amount. /// - Returns: A new padded image or nil if something goes wrong. - public func applyPadding(_ padding: CGFloat) -> UIImage { + func applyPadding(_ padding: CGFloat) -> UIImage { guard let image = cgImage else { return self } diff --git a/Sources/Extensions/UIImage/UIImage+SupportExtensions.swift b/Sources/Extensions/UIImage/UIImage+SupportExtensions.swift index 3db45324..2ee4e424 100644 --- a/Sources/Extensions/UIImage/UIImage+SupportExtensions.swift +++ b/Sources/Extensions/UIImage/UIImage+SupportExtensions.swift @@ -30,7 +30,7 @@ public extension Support where Base: UIImage { /// - color: The color to fill /// - size: The size of an new image. /// - Returns: A new instanse of UIImage with given size and color or nil if something goes wrong. - public static func imageWith(color: UIColor, size: CGSize) -> Support? { + static func imageWith(color: UIColor, size: CGSize) -> Support? { let width = Int(ceil(size.width)) let height = Int(ceil(size.height)) @@ -43,7 +43,7 @@ public extension Support where Base: UIImage { /// /// - Parameter fromView: The source view. /// - Returns: A new instance of UIImage or nil if something goes wrong. - public static func imageFrom(view: UIView) -> Support? { + static func imageFrom(view: UIView) -> Support? { let layerDrawingOperation = CALayerDrawingOperation(layer: view.layer, size: view.bounds.size) return layerDrawingOperation.imageFromNewContext(scale: UIScreen.main.scale)?.support.flipY() @@ -53,7 +53,7 @@ public extension Support where Base: UIImage { /// /// - Parameter color: Color to fill template image. /// - Returns: A new UIImage rendered with given color or nil if something goes wrong. - public func renderTemplate(withColor color: UIColor) -> Support? { + func renderTemplate(withColor color: UIColor) -> Support? { guard let image = base.cgImage else { return Support(base) } @@ -73,10 +73,10 @@ public extension Support where Base: UIImage { /// - color: The color of the border. /// - extendSize: Extend result image size and don't overlap source image by border. /// - Returns: A new image with rounded corners or nil if something goes wrong. - public func roundCorners(cornerRadius: CGFloat, - borderWidth: CGFloat, - color: UIColor, - extendSize: Bool = false) -> Support? { + func roundCorners(cornerRadius: CGFloat, + borderWidth: CGFloat, + color: UIColor, + extendSize: Bool = false) -> Support? { guard let image = base.cgImage else { return Support(base) @@ -103,7 +103,7 @@ public extension Support where Base: UIImage { /// Creates a new circle image. /// /// - Returns: A new circled image or nil if something goes wrong. - public func roundCornersToCircle() -> Support? { + func roundCornersToCircle() -> Support? { guard let image = base.cgImage else { return Support(base) } @@ -124,9 +124,9 @@ public extension Support where Base: UIImage { /// - borderColor: The color of the border. /// - extendSize: Extend result image size and don't overlap source image by border (default = false). /// - Returns: A new image with rounded corners or nil if something goes wrong. - public func roundCornersToCircle(borderWidth: CGFloat, - borderColor: UIColor, - extendSize: Bool = false) -> Support? { + func roundCornersToCircle(borderWidth: CGFloat, + borderColor: UIColor, + extendSize: Bool = false) -> Support? { guard let image = base.cgImage else { return Support(base) @@ -160,9 +160,9 @@ public extension Support where Base: UIImage { /// - cropToImageBounds: Should output image size match resized image size. /// Note: If passed true with ResizeMode.scaleAspectFit content mode it will give the original image. /// - Returns: A new image scaled to new size. - public func resize(newSize: CGSize, - contentMode: ResizeMode = .scaleToFill, - cropToImageBounds: Bool = false) -> Support? { + func resize(newSize: CGSize, + contentMode: ResizeMode = .scaleToFill, + cropToImageBounds: Bool = false) -> Support? { guard let image = base.cgImage else { return Support(base) @@ -180,7 +180,7 @@ public extension Support where Base: UIImage { /// Adds an alpha channel if UIImage doesn't already have one. /// /// - Returns: A copy of the given image, adding an alpha channel if it doesn't already have one. - public func applyAlpha() -> Support? { + func applyAlpha() -> Support? { guard let image = base.cgImage, !image.hasAlpha else { return Support(base) } @@ -196,7 +196,7 @@ public extension Support where Base: UIImage { /// /// - Parameter padding: The padding amount. /// - Returns: A new padded image or nil if something goes wrong. - public func applyPadding(_ padding: CGFloat) -> Support? { + func applyPadding(_ padding: CGFloat) -> Support? { guard let image = base.cgImage else { return Support(base) } diff --git a/Sources/Extensions/UIView/UIView+LoadFromNib.swift b/Sources/Extensions/UIView/UIView+LoadFromNib.swift index 9b763267..18c969c1 100644 --- a/Sources/Extensions/UIView/UIView+LoadFromNib.swift +++ b/Sources/Extensions/UIView/UIView+LoadFromNib.swift @@ -30,7 +30,7 @@ public extension UIView { /// - Parameter bundle: The bundle in which to search for the nib file. /// If you specify nil, this method looks for the nib file in the main bundle. /// - Returns: UIView or UIView subclass instance - public static func loadFromNib(bundle: Bundle? = nil) -> T where T: XibNameProtocol, T: UIView { + static func loadFromNib(bundle: Bundle? = nil) -> T where T: XibNameProtocol, T: UIView { return loadFromNib(named: T.xibName, bundle: bundle) } @@ -42,7 +42,7 @@ public extension UIView { /// If you specify nil, this method looks for the nib file in the main bundle. /// - owner: current owner /// - Returns: UIView or UIView subclass instance - public static func loadFromNib(named nibName: String, bundle: Bundle? = nil, owner: UIView? = nil) -> T { + static func loadFromNib(named nibName: String, bundle: Bundle? = nil, owner: UIView? = nil) -> T { let nib = UINib(nibName: nibName, bundle: bundle) guard let nibView = nib.instantiate(withOwner: owner, options: nil).first as? T else { diff --git a/Sources/Extensions/UIView/UIView+Rotation.swift b/Sources/Extensions/UIView/UIView+Rotation.swift index 6d029824..65c024cf 100644 --- a/Sources/Extensions/UIView/UIView+Rotation.swift +++ b/Sources/Extensions/UIView/UIView+Rotation.swift @@ -31,7 +31,7 @@ public extension UIView { - parameter repeatCount: How many times the spin should be done. If not provided, the view will spin forever. - parameter clockwise: Direction of the rotation. Default is clockwise (true). */ - public func startZRotation(duration: CFTimeInterval = 1, repeatCount: Float = Float.infinity, clockwise: Bool = true) { + func startZRotation(duration: CFTimeInterval = 1, repeatCount: Float = Float.infinity, clockwise: Bool = true) { let animation = CABasicAnimation.zRotationAnimationWith(duration: duration, repeatCount: repeatCount, clockwise: clockwise) @@ -39,7 +39,7 @@ public extension UIView { } /// Stop rotating the view around Z axis. - public func stopZRotation() { + func stopZRotation() { layer.removeAnimation(forKey: CABasicAnimation.rotationKeyPath) } diff --git a/Sources/Extensions/UIViewController/UIViewController+TopVisibleViewController.swift b/Sources/Extensions/UIViewController/UIViewController+TopVisibleViewController.swift index 953fff5e..eea58594 100644 --- a/Sources/Extensions/UIViewController/UIViewController+TopVisibleViewController.swift +++ b/Sources/Extensions/UIViewController/UIViewController+TopVisibleViewController.swift @@ -25,7 +25,7 @@ import UIKit public extension UIViewController { /// Return top visible controller even if we have inner UI(Navigation/TabBar)Controller's inside - public var topVisibleViewController: UIViewController { + var topVisibleViewController: UIViewController { switch self { case let navController as UINavigationController: return navController.visibleViewController?.topVisibleViewController ?? navController diff --git a/Sources/Extensions/UIWindow/UIWindow+Extensions.swift b/Sources/Extensions/UIWindow/UIWindow+Extensions.swift index 994800db..22514fc5 100644 --- a/Sources/Extensions/UIWindow/UIWindow+Extensions.swift +++ b/Sources/Extensions/UIWindow/UIWindow+Extensions.swift @@ -32,7 +32,7 @@ public extension UIWindow { /// Method changes root controller in window. /// /// - Parameter controller: New root controller. - public func changeRootController(controller: UIViewController) { + func changeRootController(controller: UIViewController) { animateRootViewControllerChanging(controller: controller) rootViewController?.dismiss(animated: false, completion: nil) diff --git a/Sources/Extensions/UserDefaults/UserDefaults+MappableDataTypes.swift b/Sources/Extensions/UserDefaults/UserDefaults+MappableDataTypes.swift index e2a92879..b9db3c3c 100644 --- a/Sources/Extensions/UserDefaults/UserDefaults+MappableDataTypes.swift +++ b/Sources/Extensions/UserDefaults/UserDefaults+MappableDataTypes.swift @@ -56,7 +56,7 @@ public extension UserDefaults { /// /// - returns: The object with specified type associated with the specified key, /// or throw exception if the key was not found. - public func object(forKey key: String) throws -> T where T: ImmutableMappable { + func object(forKey key: String) throws -> T where T: ImmutableMappable { let jsonObject = try storedValue(forKey: key) as JSONObject do { @@ -74,7 +74,7 @@ public extension UserDefaults { /// /// - returns: The array of objects with specified type associated with the specified key, /// or throw exception if the key was not found. - public func objects(forKey key: String) throws -> [T] where T: ImmutableMappable { + func objects(forKey key: String) throws -> [T] where T: ImmutableMappable { let jsonArray = try storedValue(forKey: key) as [JSONObject] do { @@ -92,7 +92,7 @@ public extension UserDefaults { /// /// - returns: The object with specified type associated with the specified key, or passed default value /// if there is no such value for specified key or if error occurred during mapping. - public func object(forKey key: String, defaultValue: T) -> T where T: ImmutableMappable { + func object(forKey key: String, defaultValue: T) -> T where T: ImmutableMappable { return (try? object(forKey: key)) ?? defaultValue } @@ -104,7 +104,7 @@ public extension UserDefaults { /// /// - returns: The array of objects with specified type associated with the specified key, or passed default value /// if there is no such value for specified key or if error occurred during mapping. - public func objects(forKey key: String, defaultValue: [T]) -> [T] where T: ImmutableMappable { + func objects(forKey key: String, defaultValue: [T]) -> [T] where T: ImmutableMappable { return (try? objects(forKey: key)) ?? defaultValue } @@ -113,7 +113,7 @@ public extension UserDefaults { /// - Parameters: /// - model: The object with specified type to store or nil to remove it from the defaults database. /// - key: The key with which to associate with the value. - public func set(model: T?, forKey key: String) where T: ImmutableMappable { + func set(model: T?, forKey key: String) where T: ImmutableMappable { if let model = model { set(model.toJSON(), forKey: key) } else { @@ -126,7 +126,7 @@ public extension UserDefaults { /// - Parameters: /// - models: The array of object with specified type to store or nil to remove it from the defaults database. /// - key: The key with which to associate with the value. - public func set(models: S?, forKey key: String) where T: ImmutableMappable, S: Sequence, S.Iterator.Element == T { + func set(models: S?, forKey key: String) where T: ImmutableMappable, S: Sequence, S.Iterator.Element == T { if let models = models { set(models.map { $0.toJSON() }, forKey: key) } else { diff --git a/Sources/Protocols/LoadingIndicator.swift b/Sources/Protocols/LoadingIndicator.swift index 24cc2af5..3948eb14 100644 --- a/Sources/Protocols/LoadingIndicator.swift +++ b/Sources/Protocols/LoadingIndicator.swift @@ -29,7 +29,7 @@ public protocol LoadingIndicatorHolder: class { } public extension LoadingIndicatorHolder where Self: UIView { - public var indicatorOwner: UIView { + var indicatorOwner: UIView { return self } } diff --git a/Sources/Protocols/StoryboardProtocol.swift b/Sources/Protocols/StoryboardProtocol.swift index a7f3e754..09b437af 100644 --- a/Sources/Protocols/StoryboardProtocol.swift +++ b/Sources/Protocols/StoryboardProtocol.swift @@ -53,7 +53,7 @@ public protocol StoryboardProtocol { public extension StoryboardProtocol { - public static func instantiate(_ identificator: Self.ViewControllerIdentifier) -> T { + static func instantiate(_ identificator: Self.ViewControllerIdentifier) -> T { guard let controller = instantiateViewController(identificator) as? T else { assertionFailure("\(T.self) not created") return T() diff --git a/Sources/Protocols/SupportProtocol.swift b/Sources/Protocols/SupportProtocol.swift index 364b493b..8e1b36f3 100644 --- a/Sources/Protocols/SupportProtocol.swift +++ b/Sources/Protocols/SupportProtocol.swift @@ -63,7 +63,7 @@ public protocol SupportCompatible { public extension SupportCompatible { /// Support extensions. - public static var support: Support.Type { + static var support: Support.Type { get { return Support.self } @@ -73,7 +73,7 @@ public extension SupportCompatible { } /// Support extensions. - public var support: Support { + var support: Support { get { return Support(self) }