This file contains 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
#!/bin/sh | |
set -euo pipefail | |
# Set the paths to your Old/New Xcodes | |
OLD_XCODE="/Applications/Xcode-14.3.1.app" | |
NEW_XCODE="/Applications/Xcode-15.0.0.app" # To get build number | |
# Get New Xcode build number | |
OLD_XCODE_BUILD=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" ${OLD_XCODE}/Contents/Info.plist) |
This file contains 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
@discardableResult | |
func run<T>(_ operation: () async throws -> T, | |
defer deferredOperation: () async throws -> Void) async throws -> T { | |
do { | |
let result = try await operation() | |
try await deferredOperation() | |
return result | |
} catch { | |
try await deferredOperation() | |
throw error |
This file contains 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 SwiftUI | |
import Charts | |
import PlaygroundSupport | |
let spiData: [(package: String, fileCount: Int, mbSize: Int)] = [ | |
(package: "swift-markdown-ui", fileCount: 3796, mbSize: 44), | |
(package: "Microya", fileCount: 414, mbSize: 4), | |
(package: "swift-url-routing", fileCount: 9430, mbSize: 101), |
This file contains 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 Foundation | |
import NIO | |
extension Array where Element == EventLoopFuture<Void> { | |
/// Converts a collection of `EventLoopFuture<Void>`s to an `EventLoopFuture<Void>`. | |
/// | |
/// Acts as a helper for the `EventLoop.flatten(_:[EventLoopFuture<Value>])` method. | |
/// | |
/// let futures = [el.future(1), el.future(2), el.future(3), el.future(4)] |
This file contains 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
enum Barcode { | |
case upc(Int, Int, Int, Int) | |
case qrCode(String) | |
} | |
var productBarcode = Barcode.upc(8, 85909, 51226, 3) | |
productBarcode = .qrCode("ABCDEFGHIJKLMNOP") | |
switch productBarcode { |
This file contains 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 | |
func context(for cgImage: CGImage) -> CGContext? { | |
guard | |
let space = cgImage.colorSpace, | |
let context = CGContext( | |
data: nil, | |
width: cgImage.width, | |
height: cgImage.height, | |
bitsPerComponent: cgImage.bitsPerComponent, |
This file contains 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
clean: | |
@# just delete specific directories instead of .builds so we don't | |
@# have to re-fetch dependencies | |
@rm -f .build/debug | |
@rm -rf .build/x86_64-apple-macosx/ | |
@rm -rf .build/x86_64-unknown-linux/ | |
@rm -rf .build/x86_64-unknown-linux-gnu/ | |
macos-spm-4.2: clean | |
@echo |
This file contains 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
// See: https://www.swiftbysundell.com/tips/inline-wrapping-of-uikit-or-appkit-views-within-swiftui/ | |
import SwiftUI | |
#if os(iOS) | |
public struct Wrap<Wrapped: UIView>: UIViewRepresentable { | |
public typealias Updater = (Wrapped, Context) -> Void | |
var makeView: () -> Wrapped |
This file contains 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 Combine | |
import ComposableArchitecture | |
import ComposableArchitectureTestSupport | |
import XCTest | |
class MainViewTests: XCTestCase { | |
func test_run() throws { | |
// Setup | |
struct State: Equatable { | |
var busy = false |
This file contains 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
// | |
// CAProtocols.swift | |
// RequirementEditor | |
// | |
// Created by Sven A. Schmidt on 29/03/2020. | |
// Copyright © 2020 finestructure. All rights reserved. | |
// | |
import SwiftUI |