I hereby claim:
- I am mrackwitz on github.
- I am mrackwitz (https://keybase.io/mrackwitz) on keybase.
- I have a public key ASApegb3sa4x4fXpvI2BzyiPyoryjA9sc6HwWNxh_X9uTwo
To claim this, I am signing this object:
| import SwiftUI | |
| // MARK: - App | |
| @main | |
| struct MyApp: App { | |
| var body: some Scene { | |
| WindowGroup { | |
| ContentView() | |
| } |
| struct AutoHeightLabelView: View { | |
| var attributedString: NSAttributedString | |
| var body: some View { | |
| HorizontalGeometryReader { width in | |
| UILabelView( | |
| attributedString: attributedString, | |
| preferredMaxLayoutWidth: width | |
| ) | |
| } |
| import SwiftUI | |
| import Combine | |
| @propertyWrapper | |
| struct Debounced<Value>: DynamicProperty { | |
| private class Box: ObservableObject { | |
| let value = PassthroughSubject<Value, Never>() | |
| @Published | |
| private(set) var debounced: Value |
| import Foundation | |
| let calendar = Calendar(identifier: .gregorian) | |
| // Daylight Saving Time ends in 2017 on Nov 5th, 2:00 AM in the United States. | |
| // Let's instantiate some `Date`s around that. | |
| let nov4_1am = calendar.date(from: DateComponents(year: 2017, month: 11, day: 4, hour: 1))! | |
| let nov4_2am = calendar.date(from: DateComponents(year: 2017, month: 11, day: 4, hour: 2))! |
I hereby claim:
To claim this, I am signing this object:
| # Note: This script makes compromises. | |
| # Default to `pod env` if available. | |
| # If you use Bundler, run it with `bundle exec`. | |
| INDENT=' ' | |
| function indent() { | |
| sed "2,\$s/^/$INDENT/" | |
| } | |
| function repos { |
This small example is a little CLI tool to demonstrate how you can make use of the new error handling of Swift 2. It was part of my talk "Swift 2 - Error Handling".
xcrun -sdk macosx swiftc main.swift../main AMOUNT)| # This will enforce that the pods with the names in the list below will be duplicated. | |
| targets_to_duplicate = %w(AFNetworking) | |
| pre_install do |installer| | |
| pod_targets = installer.pod_targets.flat_map do |pod_target| | |
| targets_to_duplicate.include?(pod_target.name) ? pod_target.scoped : pod_target | |
| end | |
| installer.aggregate_targets.each do |aggregate_target| | |
| aggregate_target.pod_targets = pod_targets.select do |pod_target| | |
| pod_target.target_definitions.include?(aggregate_target.target_definition) | |
| end |
| require 'pathname' | |
| require 'json' | |
| def xcconfigs_merge(json, xcconfig) | |
| (json['xcconfig'] || {}).each do |key,value| | |
| (xcconfig[key] ||= []) << value | |
| end | |
| (json['subspecs'] || []).each do |subspec| | |
| xcconfigs_merge(subspec, xcconfig) | |
| end |
| #!/bin/sh | |
| # buildFacebookSdk.sh | |
| # | |
| # This can be included as a build phase in Xcode. | |
| # It will ensure that the Facebook-SDK is built, when your project was | |
| # originally checked out and whenever the commit pointer was changed. | |
| # Furthermore you can use it with your CI. It will integrate seamlessly with | |
| # the xctool output. | |
| # |