- C-a == Ctrl-a
- M-a == Alt-a
:q close
:w write/saves
:wa[!] write/save all windows [force]
:wq write/save and close
protocol KeyPathUpdatable {} | |
extension KeyPathUpdatable { | |
func updating<LeafType>(_ keyPath: WritableKeyPath<Self, LeafType>, to value: LeafType) -> Self { | |
var copy = self | |
copy[keyPath: keyPath] = value | |
return copy | |
} | |
} |
// The SwiftUI Lab | |
// Website: https://swiftui-lab.com | |
// Article: https://swiftui-lab.com/alignment-guides | |
import SwiftUI | |
class Model: ObservableObject { | |
@Published var minimumContainer = true | |
@Published var extendedTouchBar = false | |
@Published var twoPhases = true |
// | |
// UIView+Tooltips.h | |
// Crossword | |
// | |
// Created by Steven Troughton-Smith on 13/09/2019. | |
// Copyright © 2019 Steven Troughton-Smith. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> |
Installation procedure for pre-build actions to automatically populate Xcode Info.plist with dynamic data.
Edit Xcode Scheme and add a pre-action script.
Copy the contents of preaction.sh
into the pre-action script box.
// Common - Portuguese - pt-BR.lproj/Localizable.strings | |
// "common.change" = "Mudar"; | |
// "common.error" = "Erro"; | |
// "common.delete" = "Exluir"; | |
// "common.wait" = "Aguarde"; | |
// Common - English - en.lproj/Localizable.strings | |
// "common.change" = "Change"; | |
// "common.error" = "Error"; | |
// "common.delete" = "Delete"; |
extension Sequence { | |
func groupSort(ascending: Bool = true, byDate dateKey: (Iterator.Element) -> Date) -> [[Iterator.Element]] { | |
var categories: [[Iterator.Element]] = [] | |
for element in self { | |
let key = dateKey(element) | |
guard let dayIndex = categories.index(where: { $0.contains(where: { Calendar.current.isDate(dateKey($0), inSameDayAs: key) }) }) else { | |
guard let nextIndex = categories.index(where: { $0.contains(where: { dateKey($0).compare(key) == (ascending ? .orderedDescending : .orderedAscending) }) }) else { | |
categories.append([element]) | |
continue | |
} |
import XCTest | |
class NotificationTestCase: XCTestCase { | |
func testTriggerNotification() { | |
expectation(forNotification: .fooBar, | |
object: nil, | |
handler: nil) | |
let notificationCenter = NotificationCenter.default |