Skip to content

Instantly share code, notes, and snippets.

Jan Damm jandamm

Block or report user

Report or block jandamm

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
View associatedReturn.swift
protocol Test {
associatedtype Output
func test() -> Output
}
struct A: Test {
typealias Output = Void
func test() {
print("aa")
}
View weak-in-functions.swift
import UIKit
func returnsNil() -> UIView? {
weak var view: UIView? = UIView()
return view
}
func returnsView1() -> UIView? {
weak var view: UIView?
view = UIView()
@jandamm
jandamm / Protocol.swift
Last active Jan 21, 2018
Static vs dynamic dispatch for protocol extensions
View Protocol.swift
protocol A {
func a()
}
extension A {
func a() {
print("protocol extension a")
}
func b() {
@jandamm
jandamm / SafeZip2Sequence.swift
Last active Jan 21, 2018
This is a Gist for a blogpost I did.
View SafeZip2Sequence.swift
/// In contrast to the Swift Zip2Sequence this type will not omit values that don't have a partner due to Sequence length mismatch.
/// The Iterator will iterate over `SafeZip2Sequence.Value`.
public struct SafeZip2Sequence<Sequence1: Sequence, Sequence2: Sequence> {
fileprivate let sequence1: Sequence1
fileprivate let sequence2: Sequence2
}
extension SafeZip2Sequence: Sequence {
/// An iterator for `SafeZip2Sequence`.
public struct Iterator {
@jandamm
jandamm / ExampleCraftSwift.swift
Last active Mar 21, 2016
InVision Craft-Plugin Styles for Swift
View ExampleCraftSwift.swift
//
// Example.swift
//
// Created by Jan Dammshäuser
// Copyright © 2016 Jan Dammshäuser. All rights reserved.
//
import UIKit
class ExampleVC: UIViewController {
You can’t perform that action at this time.