Skip to content

Instantly share code, notes, and snippets.

Avatar

Artem Starosvetskiy artyom-stv

View GitHub Profile
View JSONDecoder+JSONPointer.swift
public extension JSONDecoder {
struct CodingPathComponent {
private enum Storage {
case int(Int)
case string(String)
}
var intValue: Int? {
switch storage {
case let .int(value):
@artyom-stv
artyom-stv / gist:a87f572999074aa9afab03d8e96eef2e
Last active May 31, 2022
Visitor-based approach for accessing `@ViewBuilder`-provided content
View gist:a87f572999074aa9afab03d8e96eef2e
// SwiftUI public API
public protocol View {
associatedtype Body: View
var body: Self.Body { get }
}
extension Never: View {
public typealias Body = Never
@artyom-stv
artyom-stv / BoxableTypes.h
Created Oct 24, 2018
How to write on Objective-C in 2018. Part 1
View BoxableTypes.h
// MIT License
//
// Copyright (c) 2018 Joom
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions: