Skip to content

Instantly share code, notes, and snippets.

@Patrik-svobodik
Patrik-svobodik / configure.swift
Created Jun 21, 2020
configure vs self-executing closure
View configure.swift
// BAD
let idgaf: UILabel = {
let label = UILabel()
label.text = "huh"
return label
}()
// GOOD
let disIsGood = configure(UILabel() {
$0.text = "YAAY"
@Patrik-svobodik
Patrik-svobodik / arrAsDict.swift
Last active Apr 24, 2020
Array as a dictionary
View arrAsDict.swift
struct Model {
var id: String
var value: Int
}
var arrAsDict = [
Model(id: "foo", value: 2),
Model(id: "bar", value: 5)
]
@Patrik-svobodik
Patrik-svobodik / SegTab.swift
Created Jul 20, 2019
SegmentedControl as tabs
View SegTab.swift
//
// SegTab.swift
// SegmentedControlAsTabs
//
// Created by Patrik Svoboda on 20/07/2019.
// Copyright © 2019 Patrik Svoboda. All rights reserved.
//
import SwiftUI
You can’t perform that action at this time.