Skip to content

Instantly share code, notes, and snippets.

View ruslangazizov's full-sized avatar
📱
👨‍💻🏐🏀

Ruslan Gazizov ruslangazizov

📱
👨‍💻🏐🏀
  • Kazan, Russia
  • 19:29 (UTC +03:00)
View GitHub Profile
@ruslangazizov
ruslangazizov / CustomOptional.swift
Last active September 24, 2022 18:01
Custom implementation of swift's Optional enum
enum CustomOptional<Wrapped> {
case none
case some(Wrapped)
public init(_ some: Wrapped) {
self = .some(some)
}
func map<U>(_ transform: (Wrapped) throws -> U) rethrows -> CustomOptional<U> {
switch self {