This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Day rawValues used in WeekdaySet. Day proper names capitalized. | |
enum Day: UInt8, CaseIterable { | |
case Sunday = 0b00000001 | |
case Monday = 0b00000010 | |
case Tuesday = 0b00000100 | |
case Wednesday = 0b00001000 | |
case Thursday = 0b00010000 | |
case Friday = 0b00100000 | |
case Saturday = 0b01000000 | |
var description: String { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// StdLibExtensions.swift | |
// | |
// Created by Bill Morrison on 1/19/19. | |
// | |
import Foundation | |
extension UInt64 { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2016 Razeware LLC | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is | |
* furnished to do so, subject to the following conditions: | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://developer.apple.com/documentation/foundation/urlsession/processing_url_session_data_task_results_with_combine | |
import Foundation | |
import Combine | |
let cancellable = URLSession.shared | |
.dataTaskPublisher(for: URL(string: "https://jsonplaceholder.typicode.com/users")!) | |
.tryMap() { element -> Data in | |
guard let httpResponse = element.response as? HTTPURLResponse, | |
httpResponse.statusCode == 200 else { | |
throw URLError(.badServerResponse) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: These Swift examples follow the Objective-C found in [NSRegularExpression](https://developer.apple.com/documentation/foundation/nsregularexpression) | |
import Foundation | |
let regex1 = try! NSRegularExpression(pattern: "\\b(a|b)(c|d)\\b", options: [.caseInsensitive]) | |
let string1 = "Test with Ad and ad and Ac and AC and bD and bd and Bc and BC in the string." | |
let range1 = NSMakeRange(0, string1.count) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
import PlaygroundSupport | |
//: ### Put Localizable.stringsdict in ~/Documents/Shared Playground Data | |
let bundle = Bundle(url: playgroundSharedDataDirectory)! | |
let format1 = NSLocalizedString("beers_on_wall", tableName: nil, bundle: bundle, value: "", comment: "") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DestinationsView.swift | |
// PdfDocumentBrowser | |
// | |
// Created by Bill Morrison on 2/22/20. | |
// Copyright © 2020 Bill Morrison. All rights reserved. | |
// | |
import SwiftUI | |
import PDFKit |