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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Localize.py - Incremental localization on XCode projects | |
# João Moreno 2009 | |
# http://joaomoreno.com/ | |
# Modified by Steve Streeting 2010 http://www.stevestreeting.com | |
# Changes | |
# - Use .strings files encoded as UTF-8 |
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
CKContainer.default().requestApplicationPermission(.userDiscoverability) { status, error in | |
guard status == .granted, error == nil else { | |
// error handling voodoo | |
return | |
} | |
CKContainer.default().discoverUserIdentity(withUserRecordID: recordID) { identity, error in | |
guard let components = identity?.nameComponents, error == nil else { | |
// more error handling magic | |
return |
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
dtre | |
Device Tree with 19 properties and 10 children | |
Properties: | |
device-tree: | |
| +--name 12 bytes: device-tree | |
| +--target-type 5 bytes: J137 | |
| +--mlb-serial-number 29 bytes: syscfg/MLB#/0x20,zeroes/0x20 | |
| +--compatible 27 bytes: J137AP | |
| +--secure-root-prefix 3 bytes: md | |
| +--AAPL,phandle 4 bytes: 1 |
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
if [ "$EFFECTIVE_PLATFORM_NAME" = "-maccatalyst" ]; then | |
echo "Adding com.apple.developer.homekit entitlement" | |
/usr/libexec/PlistBuddy -c "Add :com.apple.developer.homekit bool true" "$TARGET_TEMP_DIR/$FULL_PRODUCT_NAME.xcent" | |
fi |
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
/** | |
Implementation of the "atoi" function in Swift. | |
This implementation is an exercise and should not be used in production, | |
Swift has built-in types and functions that can do this sort of conversion. | |
*/ | |
/// Parses the input string as a 32-bit integer. | |
/// Returns `nil` if the input contains non-ASCII characters, or is not a valid number. | |
func myAtoi(_ input: String) -> Int32? { | |
/// The base ASCII code, where the numbers begin. |
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
# Add this to a "Run Script" build phase in your app's main target, as the last step. | |
# It will use the pluginkit command-line tool to force the plugin system on macOS to add your extensions to its database, making them available. | |
# I made this specifically for widgets, but it should work for pretty much any extension type (appex bundle). | |
find $CODESIGNING_FOLDER_PATH -name '*.appex' -exec pluginkit -a {} \; |
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 | |
/// On macOS, modifying an Animation with .currentSpeed(), or using the .current static property | |
/// allows for easy animation debugging by holding down the Shift key when triggering the animation. | |
/// When the animation is triggered while the Shift key is pressed, it will be played in slow motion. | |
/// Using this extension has no effect when targeting other OSes or when building for release. | |
extension Animation { | |
static var currentSpeed: Double { | |
#if DEBUG |
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
#if DEBUG | |
/* | |
This fixes SwiftUI previews not rendering translucent materials correctly by | |
swizzling a couple of properties on NSWindow. | |
Just drop into your project and add to the target being previewed (or something it links against). | |
Notice the #if DEBUG, so this code won't end up in release builds. It also checks for the | |
XCODE_RUNNING_FOR_PREVIEWS environment variable so that it won't affect regular debug builds of the app. |
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
/* | |
Example: | |
let v1 = SemanticVersion(string: "1.0.0") | |
let v2 = SemanticVersion(string: "2.0.0") | |
print(v1 > v2) // false | |
print(v2 > v1) // true |
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
alias statusbarfix='xcrun simctl status_bar booted override --time 9:41 --cellularMode active --cellularBars 4 --batteryState charging --operatorName ""' |