Skip to content

Instantly share code, notes, and snippets.

@juliancadi
juliancadi / NiblessViewController.swift
Last active June 23, 2023 09:38
Nibless UIViewController in favor of initializer dependency injection.
import UIKit
open class NiblessViewController: UIViewController {
public init() {
super.init(nibName: nil, bundle: nil)
}
@available(*, unavailable,
message: "Loading this view controller from a nib is unsupported in favor of initializer dependency injection."
@romyilano
romyilano / appleSearchBarSample.swift
Last active June 15, 2022 17:14
Various search bar implementations. Including an RxSwift / reactive swift version too
//https://developer.apple.com/library/content/samplecode/TableSearch_UISearchController/Introduction/Intro.html
// MARK: - UISearchResultsUpdating
func updateSearchResults(for searchController: UISearchController) {
// Update the filtered array based on the search text.
let searchResults = products
// Strip out all the leading and trailing spaces.
let whitespaceCharacterSet = CharacterSet.whitespaces