This is now available in a dedicated package: ActivityView
Alternatively my SwiftUI Backports now includes a more complete implementation of ShareLink
that's also more performant.
// This gist demonstrates how you can implement versioning for a Codable struct to support loading | |
// old serialized data after changing the structure. Notable features of this solution: | |
// | |
// * No need to make new properties optional, or to perform post-processing on the struct after | |
// loading in ordeer to populate missing values | |
// * No need to change the call site - from the outside this struct behaves just the same | |
// as if we had implemented codable directly in the normal way. | |
// * Versioning can be applied individually to parents or leaves in a larger tree of | |
// structs without affecting the other elements | |
// * This approach will work even if the original struct was not designed with versioning in mind |
#!/bin/bash | |
# SPDX-License-Identifier: MIT | |
# SPDX-FileCopyrightText: 2018 Ben Siraphob <[email protected]> | |
command -v gshuf >/dev/null 2>&1 || { echo >&2 "gshuf is required but is not installed. Run \"brew install coreutils\"."; control_c; } | |
command -v spoof-mac >/dev/null 2>&1 || { echo >&2 "spoof-mac is required but is not installed. Run \"brew install spoof-mac\"."; control_c; } | |
# Colors | |
RED='\033[0;31m' | |
NC='\033[0m' |
extension Collection { | |
func parallelMap<T>( | |
parallelism requestedParallelism: Int? = nil, | |
_ transform: @escaping (Element) async throws -> T | |
) async throws -> [T] { | |
let defaultParallelism = 2 | |
let parallelism = requestedParallelism ?? defaultParallelism | |
let n = self.count | |
if n == 0 { |
This is now available in a dedicated package: ActivityView
Alternatively my SwiftUI Backports now includes a more complete implementation of ShareLink
that's also more performant.
UIImageView
address (e.g. via view debugger)po [UIImagePNGRepresentation((UIImage *)[_address_ image]) base64EncodedStringWithOptions:0]
pbpaste | base64 -D > image.png
To install add to ~/.config/fish/functions/
. This can be done manually or via curl -o ~/.config/fish/functions/fastlane.fish https://gist.githubusercontent.com/JosephDuffy/596821c21b6810dd0c82639b1c6b8a64/raw/fastlane.fish
This function has 2 primary advantages:
bundle exec
before fastlane
commandsfastlane enable_auto_complete
Disclamer: My fish scripting skills aren't exactly 💯. If you have any suggestions for improvements please tweet them at me!
import Foundation | |
struct Partial<Wrapped>: CustomStringConvertible, CustomDebugStringConvertible { | |
enum Error<ValueType>: Swift.Error { | |
case missingKey(KeyPath<Wrapped, ValueType>) | |
case invalidValueType(key: KeyPath<Wrapped, ValueType>, actualValue: Any) | |
} | |
private var values: [PartialKeyPath<Wrapped>: Any?] = [:] |
import UIKit | |
final class ExampleViewController: UViewController { | |
private var usersBrightness = UIScreen.main.brightness | |
private var willEnterForegroundWasCalled = false | |
private var viewWillDisappearWasCalled = false | |
override func viewDidLoad() { |
# Author: Joseph Duffy | |
# License: MIT | |
# Notes: Place this script in `~/.config/fish/completions/` to enable Fastlane lane completion | |
# URL: https://gist.github.com/JosephDuffy/e40fc115f849555c5ef8453d3ece1c10 | |
# This function was taken from https://github.com/Carthage/Carthage/blob/master/Source/Scripts/carthage-fish-completion | |
function __fish_prog_needs_subcommand | |
set cmd (commandline -opc) | |
if [ (count $cmd) -eq 1 -a $cmd[1] = 'fastlane' ] | |
return 0 |
Remove ._*- and .AppleDouble-files from folders. | |
Adapted from Torkel's comment on http://hints.macworld.com/article.php?story=20021118060850652 | |
Cred to hiber for suggesting adding -print0/-0 to solve whitespace issue. | |
See all ._*-files: | |
find . -name '._*' | more | |
Remove all ._*-files: | |
find . -name '._*' -print0 | xargs -0 rm |