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
let layout = UICollectionViewCompositionalLayout(sectionProvider: { | |
(sectionIndex: Int, layoutEnvironment: NSCollectionLayoutEnvironment) -> NSCollectionLayoutSection? in | |
let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), | |
heightDimension: .estimated(30)) | |
let item = NSCollectionLayoutItem(layoutSize: itemSize) | |
let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), | |
heightDimension: .estimated(30)) |
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/bash -e | |
echo "🤡 Applying carthage 12 and 13 workaround 🤡" | |
xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX) | |
# For Xcode 12 make sure EXCLUDED_ARCHS is set to arm architectures otherwise | |
# the build will fail on lipo due to duplicate architectures. | |
CURRENT_XCODE_VERSION=$(xcodebuild -version | grep "Build version" | cut -d' ' -f3) | |
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = arm64 arm64e armv7 armv7s armv6 armv8' > $xcconfig | |
echo "EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_$CURRENT_XCODE_VERSION = arm64 arm64e armv7 armv7s armv6 armv8" >> $xcconfig |
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 | |
fileprivate extension DateFormatter { | |
static var month: DateFormatter { | |
let formatter = DateFormatter() | |
formatter.dateFormat = "MMMM" | |
return formatter | |
} | |
static var monthAndYear: DateFormatter { |
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
# TODO: replace :token, :user, and :repo | |
curl -H "Authorization: token :token" \ | |
-H 'Accept: application/vnd.github.everest-preview+json' \ | |
"https://api.github.com/repos/:user/:repo/dispatches" \ | |
-d '{"event_type": "awesomeness", "client_payload": {"foo": "bar"}}' |
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
# Change Xcode version in GitHub Actions | |
As of today (2019-08-21) I haven't found any documentation on changing Xcode versions when | |
using GitHub actions. So I checked the applications folder and everything we need is | |
already there. 🤩 | |
``` | |
> ls -n /Applications/ | grep Xcode* | |
lrwxr-xr-x 1 0 80 30 Aug 2 19:31 Xcode.app -> /Applications/Xcode_10.2.1.app | |
drwxr-xr-x 3 501 20 96 Oct 20 2018 Xcode_10.1.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
## put this file under /usr/local/bin | |
git diff develop --name-only | while read filename; do | |
if [[ $filename == *.swift ]] | |
then | |
swiftlint autocorrect --path "$filename"; | |
fi | |
done |
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
// | |
// FilePickerPresentedView.swift | |
// flysight-grapher | |
// | |
// Created by richö butts on 7/8/19. | |
// Copyright © 2019 richö butts. All rights reserved. | |
// | |
import Foundation | |
import SwiftUI |
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
(lldb) expr -l Swift -- import UIKit | |
(lldb) expr -l Swift -- let $view = unsafeBitCast(0x7fbe2ac66ee0, to: UIView.self) | |
(lldb) expr -l Swift -- print($view.superview) |
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 Dispatch | |
import Foundation | |
var x = 7 | |
let dd = withUnsafeBytes(of: &x, { DispatchData.init(bytes: $0) }) | |
print(dd as? Data) // Case 1: nil | |
print(dd as? NSData) // Case 2: nil | |
print(dd as Any as? Data) // Case 3: nil | |
print(dd as Any as? NSData) // Case 4: .some | |
print(dd as Any as? NSData as Data?) // Case 5: .some |
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
.DS_Store | |
.tags* | |
/.idea/ | |
/build/ | |
/dist/ | |
/external_binaries/ | |
/out/ | |
/vendor/download/ | |
/vendor/debian_jessie_amd64-sysroot/ | |
/vendor/debian_jessie_arm-sysroot/ |
NewerOlder