Skip to content

Instantly share code, notes, and snippets.

View xbladesub's full-sized avatar
🦀
Rust !

NSHV xbladesub

🦀
Rust !
View GitHub Profile
@xbladesub
xbladesub / JSONSaveLoad.swift
Created April 27, 2022 16:40 — forked from norsez/JSONSaveLoad.swift
Load and Save JSON objects into a local file (written in 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
@xbladesub
xbladesub / asyncAwaitInCombine.swift
Created November 21, 2021 07:37 — forked from Monntay/asyncAwaitInCombine.swift
async await in combine
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 July 16, 2021 13:55
macOS installed apps information
class MacOSAppsInfoFetcher {
var query: NSMetadataQuery? {
willSet {
if let query = self.query {
query.stop()
}
}
}