Skip to content

Instantly share code, notes, and snippets.

View ionel71089's full-sized avatar
🍎
Eating an apple.

Ionel Lescai ionel71089

🍎
Eating an apple.
View GitHub Profile
import Foundation
@propertyWrapper
struct StringRepresentation<T: LosslessStringConvertible> {
private var value: T?
var wrappedValue: T? {
get {
return value
}
@ionel71089
ionel71089 / dictionary path
Created August 26, 2016 22:48
get/set values from dictionary with a path
//: Playground - noun: a place where people can play
import UIKit
extension Array {
private var x:Element? { return self.first }
private var xs: [Element] { return [Element](self.dropFirst()) }
var parts: (Element?, [Element]) {
return (self.x, self.xs)
}
@ionel71089
ionel71089 / genericTableViewPlayground.swift
Last active October 16, 2019 20:37
Generic Table View Controller with Data Template and Data Template Selector inspired from XAML
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
protocol IDataTemplate {
associatedtype Item
associatedtype Cell: UITableViewCell
func register(tableView: UITableView)
func configuredCell(tableView: UITableView, for indexPath: IndexPath, with item: Item) -> Cell