The document discusses how adopting a SOLID architecture and design patterns can help address weaknesses of the "Dark Side" like lack of robustness, testability, and team collaboration. It promotes using SOLID principles like single responsibility, open/closed, Liskov substitution, and dependency inversion. Examples show applying these principles through concepts like entities, use cases, presenters, and segregating interfaces. Adopting these practices leads to code that is more reusable, flexible, and replaceable.
30. Take me Outta Here
func presentCell(cell: SpeakerCellProtocol, indexPath:
NSIndexPath) {
let index = indexPath.row
guard index < speakers.count else { return }
let speaker = speakers[index]
cell.displayName(speaker.name)
cell.displayTitle(speaker.title)
cell.displayDateSubmitted(relativeDateStringFromDate(s
peaker.dateSubmitted))
}
Know
That!
32. class Text {
func displayContents() {
print("Hola")
}
}
class NullText: Text {
override func displayContents() {
print(“Not much here")
}
}
func fetchText() -> Text {
return NullText()
}
let text = fetchText()
text.displayContents()
Null Object
class Text {
func displayContents() {
print("Hola")
}
}
func fetchText() -> Text? {
return nil
}
if let text = fetchText() {
text.displayContents()
}
36. #SwiftDarkSide
Recommendations
Pay attention to your architecture; It
always pays off
Use Principles to take decisions
Take advantage of the language and adapt
the patterns to it
In case of doubt, ask for an architecture
loan and ship it