Swift Clean Code
Make Clean code by splitting your code into Extensions and Nested types .
Read more here - Swift clean Lazy Properties
Save this code snippet to Xcode
Code Snippet
// MARK: - Factory
private extension <#Class#> {
private class Factory {
class func <#funcName#>() -> <#ReturnType#> {
return <#code#>
}
}
}
Example
class ArmaturListViewModel {
var names = Factory.names()
}
private extension ArmaturListViewModel {
private class Factory {
class func names() -> [String] {
return [
"Petter",
"Simon",
"Anna"]
}
}
Written by Kostiantyn
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ios
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#