Skip to content

Instantly share code, notes, and snippets.

@emptyfuel
emptyfuel / DiffableDataSourceCollectionView.swift
Created Feb 27, 2021
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/
View DiffableDataSourceCollectionView.swift
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 Feb 27, 2021
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/
View DiffableDataSource.swift
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 Feb 27, 2021
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/
View UTTypeiOS14.swift
//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()