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
// | |
// CustomPicker.swift | |
// | |
// Created by T Brennan on 27/3/21. | |
// | |
import SwiftUI | |
struct ContentView: View { | |
@State private var selection: Int? = 0 |
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
# Call this inside the bin directory of a build of the Swift compiler, | |
# e.g. build/Xcode-ReleaseAssert/swift-macosx-x86_64/Release/bin. | |
# | |
# Adjust the path to match your Xode installation or pick a different binary to dump. | |
# | |
# Tested with Xcode 12.0 beta 2. | |
# | |
# Note: I used a Swift 5.3 compiler build from a few weeks ago that I had laying around. | |
# Because of ABI stability, I don't think the swift-reflection-dump version has to match | |
# the compiler version that was used to build the binary, but I'm not 100% sure. |
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
struct ContentView: View { | |
@State private var selection = 0 | |
private var actionSelection: Binding<Int> { | |
Binding<Int>(get: { | |
self.selection | |
}) { (newValue: Int) in | |
if newValue == 1 { | |
// put action here |
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
/// Throws error if ALL localizable files does not have matching keys | |
/// | |
/// - Parameter files: list of localizable files to validate | |
func validateMatchKeys(_ files: [LocalizationStringsFile]) { | |
print("------------ Validating keys match in all localizable files ------------") | |
guard let base = files.first, files.count > 1 else { return } | |
let files = Array(files.dropFirst()) | |
files.forEach { | |
guard let extraKey = Set(base.keys).symmetricDifference($0.keys).first else { return } | |
let incorrectFile = $0.keys.contains(extraKey) ? $0 : base |