This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol Loadable { | |
var activityIndicator: UIActivityIndicatorView {get} | |
func showLoaderView() | |
func hideLoaderView() | |
} | |
extension Loadable where Self: UIViewController { | |
func showLoaderView() { | |
activityIndicator.translatesAutoresizingMaskIntoConstraints = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Array { | |
func sg_flatMap<U>(transform: (Generator.Element) -> [U]) -> [U] { | |
var result = [U]() | |
for item in self { | |
result.appendContentsOf(transform(item)) | |
} | |
return result | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Array { | |
func map<U>(transform: (element: Generator.Element) -> U) -> [U]{ | |
var elements = [U]() | |
for item in self { | |
elements.append(transform(element: item)) | |
} | |
return elements | |
} | |
} |