Skip to content

Instantly share code, notes, and snippets.

Iceman sidepelican

Block or report user

Report or block sidepelican

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sidepelican
sidepelican / TypeExtract.swift
Created Sep 17, 2019
雪だるま型パラから型を順番に取り出すやつ
View TypeExtract.swift
import Foundation
protocol _View {
static var specialType: Any.Type { get }
}
protocol View: _View {
associatedtype Body: View
associatedtype Special
var body: Body { get }
View LandmarkDetail.swift
import Combine
import SwiftUI
struct IndexedCollection<Base: RandomAccessCollection>: RandomAccessCollection {
typealias Index = Base.Index
typealias Element = (index: Index, element: Base.Element)
let base: Base
var startIndex: Index { base.startIndex }
@sidepelican
sidepelican / combinationMask.swift
Created Jun 28, 2019
複数パスの図形を反転してマスク
View combinationMask.swift
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
view.backgroundColor = .white
}
@sidepelican
sidepelican / combinationMask.swift
Created Jun 28, 2019
複数パスの図形を反転してマスク
View combinationMask.swift
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
view.backgroundColor = .white
}
@sidepelican
sidepelican / ContentView.swift
Created Jun 10, 2019
BindableObjectのdidChangeは毎回同じものを返してね
View ContentView.swift
import Combine
import SwiftUI
class MyPublisher<T, E>: Publisher where E: Error {
func receive<S>(subscriber: S) where S : Subscriber, Failure == S.Failure, Output == S.Input {
inner.receive(subscriber: subscriber)
Swift.print(#function, #line)
}
typealias Output = T
View statetest.swift
import SwiftUI
struct MyNumber: View {
private let value: Int
init() {
print(#function, #line)
value = 1000
}
@sidepelican
sidepelican / a.swift
Last active Jun 5, 2019
SwiftUI List rebuild test
View a.swift
import SwiftUI
struct User: Identifiable {
var id: Int
init(id: Int) {
self.id = id
}
}
View gist:467ae186219f448fb51ca1e4daea9505
enum elseer<T> {
case `true`(T)
case `false`
func `else` (falseClosure: ()->(T)) -> T {
switch self {
case .true(let result):
return result
case .false:
You can’t perform that action at this time.