Skip to content

Instantly share code, notes, and snippets.

@emptyfuel
emptyfuel / DiffableDataSourceCollectionView.swift
Created February 27, 2021 16:18
Source code to use with Xcode playground related to the blog post on emptytheory.com at https://emptytheory.com/2021/02/27/registering-collection-view-cells-in-ios-14/
import UIKit
import PlaygroundSupport
/// Simple sample diffable table view to demonstrate using diffable data sources. Approximately 33% of the time, it should show "bad weather" UI instead of apples and oranges
final class DiffableCollectionViewController : UIViewController {
var collectionView: UICollectionView!
enum Section: String, CaseIterable, Hashable {
case apples = "Apples"
@emptyfuel
emptyfuel / DiffableDataSource.swift
Last active October 10, 2022 07:05
Source code to use with Xcode playground related to the blog post on emptytheory.com at https://emptytheory.com/2021/01/11/using-ios-diffable-data-sources-with-different-object-types/
import UIKit
import PlaygroundSupport
/// Simple sample diffable table view to demonstrate using diffable data sources. Approximately 33% of the time, it should show "bad weather" UI instead of apples and oranges
final class DiffableTableViewController : UIViewController {
var tableView: UITableView!
enum Section: String, CaseIterable, Hashable {
case apples = "Apples"
@emptyfuel
emptyfuel / UTTypeiOS14.swift
Last active December 24, 2023 15:38
Using UTType in Swift in Xcode 12 and iOS 14 related code from blog post on emptytheory.com at https://emptytheory.com/2020/09/29/better-uniform-type-identifiers-with-xcode-12/
//https://emptytheory.com/2020/09/29/better-uniform-type-identifiers-with-xcode-12/
import UniformTypeIdentifiers
//Show UTType properties for built-in type
UTType.pdf.printInfo()
//Show properties for looked up type
UTType.word.printInfo()