Skip to content

Instantly share code, notes, and snippets.

Avatar
🦀
Rust !

NSHV xbladesub

🦀
Rust !
View GitHub Profile
@xbladesub
xbladesub / JSONSaveLoad.swift
Created Apr 27, 2022 — forked from norsez/JSONSaveLoad.swift
Load and Save JSON objects into a local file (written in Swift)
View JSONSaveLoad.swift
import Foundation
/**
Extension to save/load a JSON object by filename. (".json" extension is assumed and automatically added.)
*/
extension JSONSerialization {
static func loadJSON(withFilename filename: String) throws -> Any? {
let fm = FileManager.default
View asyncAwaitInCombine.swift
extension Publisher {
func awaitSink(cancellable: inout Set<AnyCancellable>) async throws -> Output {
return try await withCheckedThrowingContinuation { continuation in
self.sink { completion in
switch completion {
case .finished:
break
@xbladesub
xbladesub / MacOSAppsInfoFetcher.swift
Last active Jul 16, 2021
macOS installed apps information
View MacOSAppsInfoFetcher.swift
class MacOSAppsInfoFetcher {
var query: NSMetadataQuery? {
willSet {
if let query = self.query {
query.stop()
}
}
}