Skip to content

Instantly share code, notes, and snippets.

Avatar
⌨️

Daniel Bernal afterxleep

⌨️
View GitHub Profile
@afterxleep
afterxleep / AnimalGenerator.2.swift
Last active Oct 18, 2020
[danielbernal.co] Protocols and Combine: Using @published in your Protocol declaration - https://danielbernal.co/combine-and-protocols-in-swift/
View AnimalGenerator.2.swift
class AnimalGenerator: Generator, ObservableObject {
@Published private(set) var name: String = ""
var namePublished: Published<String> { _name }
var namePublisher: Published<String>.Publisher { $name }
let animals = ["Cat", "Dog", "Crow", "Horse", "Iguana", "Cow", "Racoon"]
init() {
generate()
@afterxleep
afterxleep / MyTestClass.swift
Last active Oct 29, 2020
[danielbernal.co] NSSecureCoding + CoreData
View MyTestClass.swift
class MyTestClass: NSSecureCoding {
var name: String = ""
var last_name: String = ""
// Make sure you add this property
static var supportsSecureCoding: Bool = true
required init?(coder: NSCoder) {
@afterxleep
afterxleep / Networking+Combine+Codable.swift
Created Jan 11, 2021
A Playground with example code for Wirekit
View Networking+Combine+Codable.swift
import Foundation
import Combine
// The Request Method
enum HTTPMethod: String {
case get = "GET"
case post = "POST"
case put = "PUT"
case delete = "DELETE"
}