Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View afterxleep's full-sized avatar

Daniel Bernal afterxleep

View GitHub Profile
@afterxleep
afterxleep / AnimalGenerator.2.swift
Last active October 18, 2020 05:56
[danielbernal.co] Protocols and Combine: Using @published in your Protocol declaration - https://danielbernal.co/combine-and-protocols-in-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 October 29, 2020 04:54
[danielbernal.co] NSSecureCoding + CoreData
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 January 11, 2021 04:21
A Playground with example code for Wirekit
import Foundation
import Combine
// The Request Method
enum HTTPMethod: String {
case get = "GET"
case post = "POST"
case put = "PUT"
case delete = "DELETE"
}