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
import Foundation | |
enum Http { | |
typealias Callback = (Response) -> Void | |
enum Response { | |
case success(data: Any?) | |
case error(message: String?) | |
} | |
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
import UIKit | |
import CoreData | |
class DBManager { | |
private static var managedObjectContext: NSManagedObjectContext { | |
return (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext | |
} | |
class func create<E>(proccess: (_ object: E) -> Void) -> Bool { | |
do { |
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
import Foundation | |
let BASE_URL = "" | |
enum HttpMethod: String { | |
case get = "GET" | |
case post = "POST" | |
} | |
protocol HttpObserver: AnyObject { |
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
import RxSwift | |
import RxCocoa | |
let BASE_URL = "" | |
enum HttpMethod: String { | |
case get = "GET" | |
case post = "POST" | |
} |
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
struct Cachorro { | |
var nome: String | |
var raca: String | |
func latir() { | |
print("\(nome) latiu!") | |
} | |
} | |
struct Pessoa { |
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
var matador = Cachorro(nome: "Matador", raca: "Chihuahua") | |
var gerlandio = Pessoa(nome: "Gerlandio", cachorros: []) | |
gerlandio.tem(maisUm: matador) |
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
class Solucao { | |
var pessoaLogada: Pessoa? | |
func cadastrar(nome: String) { | |
pessoaLogada = Pessoa(nome: nome, cachorros: []) | |
} | |
func adicionar(cachorro: Cachorro) { | |
pessoaLogada?.tem(maisUm: cachorro) | |
} |
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
struct Cachorro { | |
var nome: String | |
var raca: String | |
} | |
struct Pessoa { | |
var nome: String | |
var cachorros: [Cachorro] | |
} |
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
func pessoa(nomePessoa: String, cachorros: [Any], nomeCachorro: String, racaCachorro: String) -> Any { | |
return "😱" | |
} |
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
let gerlandio = ("Gerlandio", []) |
OlderNewer