This library is now deprecated in favour of a more complete and SwiftUI friendly TextEditor backport:
https://github.com/shaps80/SwiftUIBackports
See it in action here: https://twitter.com/shaps/status/1654972428286668800?s=20
| struct User: Equatable { | |
| var firstName: String | |
| var lastName: String | |
| } | |
| @main | |
| struct MyApp: App { | |
| @State var value = User(firstName: "", lastName: "") | |
| @State var showEdit = false | |
This library is now deprecated in favour of a more complete and SwiftUI friendly TextEditor backport:
https://github.com/shaps80/SwiftUIBackports
See it in action here: https://twitter.com/shaps/status/1654972428286668800?s=20
| import UIKit | |
| import PlaygroundSupport | |
| let container = UIView(frame: CGRect(x: 0, y: 0, width: 500, height: 200)) | |
| container.backgroundColor = .lightGray | |
| let buttonRadius: CGFloat = 50 | |
| let buttonSize = CGSize(width: buttonRadius * 2, height: buttonRadius * 2) | |
| let buttonPath = UIBezierPath(arcCenter: CGPoint(x: buttonRadius, y: buttonRadius), radius: buttonRadius, startAngle: 0, endAngle: CGFloat.pi * 2, clockwise: true) |
| # The trick is to link the DeviceSupport folder from the beta to the stable version. | |
| # sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :) | |
| # Support iOS 15 devices (Xcode 13.0) with Xcode 12.5: | |
| sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport | |
| # Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions | |
| # (A similar approach works for older versions too, just change the version number after DeviceSupport) |
| /** | |
| Creates a dictionary with an optional | |
| entry for every element in an array. | |
| */ | |
| func toDictionary<E, K, V>( | |
| array: [E], | |
| transformer: (element: E) -> (key: K, value: V)?) | |
| -> Dictionary<K, V> | |
| { | |
| return array.reduce([:]) { |
| #!/bin/bash | |
| # update_build_number.sh | |
| # Usage: `update_build_number.sh [branch]` | |
| # Run this script after the 'Copy Bundle Resources' build phase | |
| # Ref: http://tgoode.com/2014/06/05/sensible-way-increment-bundle-version-cfbundleversion-xcode/ | |
| branch=${1:-'master'} | |
| buildNumber=$(expr $(git rev-list $branch --count) - $(git rev-list HEAD..$branch --count)) | |
| echo "Updating build number to $buildNumber using branch '$branch'." |
| # delete local tag '12345' | |
| git tag -d 12345 | |
| # delete remote tag '12345' (eg, GitHub version too) | |
| git push origin :refs/tags/12345 | |
| # alternative approach | |
| git push --delete origin tagName | |
| git tag -d tagName |
| { | |
| "AL": "Alabama", | |
| "AK": "Alaska", | |
| "AS": "American Samoa", | |
| "AZ": "Arizona", | |
| "AR": "Arkansas", | |
| "CA": "California", | |
| "CO": "Colorado", | |
| "CT": "Connecticut", | |
| "DE": "Delaware", |
| # start | |
| sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist | |
| # stop | |
| sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist |
| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://www.npmjs.org/install.sh | sh |