Skip to content

Instantly share code, notes, and snippets.

Avatar

 Kapil Rathore kapilrathore

  • Jaipur, Rajasthan
View GitHub Profile
@kapilrathore
kapilrathore / SRPFail.swift
Last active Mar 7, 2018
For medium article - SOLID Swift Using Protocols !!!
View SRPFail.swift
struct DataManager {
func manage() {
let data = loadData()
let array = parseData(data)
saveData(array)
}
func loadData() -> Data {
// load data from some URL
@kapilrathore
kapilrathore / SRPPass.swift
Last active Mar 7, 2018
For medium article - SOLID Swift Using Protocols !!!
View SRPPass.swift
struct DataManager {
let dataLoader: DataDownloader
let dataParser: DataParser
let dbManager: DBManager
init(dataLoader: DataDownloader, dataParser: DataParser, dbManager: DBManager) {
self.dataLoader = dataLoader
self.dataParser = dataParser
self.dbManager = dbManager