This gist accompanies a blog post on Masilotti.com, How to manage multiple sheets in SwiftUI.
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
// Swift toolchain version 5.0 | |
// Running macOS version 12.0 | |
// Created on 6/24/21. | |
// | |
// Author: Kieran Brown | |
// | |
import SwiftUI | |
struct CollapsibleGridLines: View { |
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
/** | |
This sample code is available under the MIT license. | |
*/ | |
@available(iOS 12.0, *) | |
public final class ShortcutManager { | |
/** | |
This enum specifies the different intents available in our app and their various properties for the `INIntent`. | |
Replace this with your own shortcuts. |
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, 2018 Nikolai Ruhe. All rights reserved. | |
// | |
import Foundation | |
public extension FileManager { | |
/// Calculate the allocated size of a directory and all its contents on the volume. |
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
# Useful for improving Time Machine backup prep. times, Mac App Store install speeds, etc. | |
sudo sysctl debug.lowpri_throttle_enabled=0 | |
# To restore defaults | |
sudo sysctl debug.lowpri_throttle_enabled=1 |
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
// | |
// UserDefaults.swift | |
// | |
// Created by Shaps Benkau on 24/05/2018. | |
// Copyright © 2018 152percent Ltd. All rights reserved. | |
// | |
import Foundation | |
#if os(iOS) |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
let fontURL = NSBundle.mainBundle().URLForResource("PillGothic300mg-bold", withExtension: "ttf") | |
CTFontManagerRegisterFontsForURL(fontURL!, CTFontManagerScope.Process, nil) | |
var pillGothicFontBold = UIFont(name: "PillGothic300mg-bold", size: 30) | |
var attrs = [NSFontAttributeName : pillGothicFontBold!, |
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
-(void) updateCountdown { | |
NSTimeInterval timeToClosing = [_deleteDate timeIntervalSinceDate:[NSDate date]]; | |
div_t h = div(timeToClosing, 3600); | |
int hours = h.quot; | |
div_t m = div(h.rem, 60); | |
int minutes = m.quot; | |
int seconds = m.rem; | |
NSString *hoursStr, *minutesStr, *secondsStr; |