/// | World |
/// |------------------------------------------|
/// | Module A | Module B | Module C | Module D|
- World is a module
- World is aware of all modules.
- Modules aren't aware of World.
#!/usr/bin/env zsh | |
# | |
# Convenience wrapper around the simctl command to perform operations related to iOS simulators. | |
# Author: Justin Williams (@justin) | |
# | |
# Usage: sim <options> <subcommand> | |
# | |
# This script is designed to work with ZSH. ymmv with other shells. | |
set -e |
import SwiftUI | |
/// A view that arranges its children in horizontal lines | |
/// | |
/// FlowStack { | |
/// ForEach(1..<100) { num in | |
/// Text(String(num)) | |
/// .padding(8) | |
/// .background(Circle().fill(Color.red)) | |
/// } |
import ReactiveSwift | |
import XCTest | |
private let counterFailure: (Int, Int) -> String = { count, maxCount in | |
return "Counter is currently at \(count) which higher than the max \(maxCount)" | |
} | |
private let timeoutFailure = "Expectation timeout" | |
private let infoTemplate: (String, String, Int) -> String = { fileName, functionName, lineNumber in |
// Copyright (c) 2019–20 Adam Sharp and thoughtbot, inc. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included in |
/// | World |
/// |------------------------------------------|
/// | Module A | Module B | Module C | Module D|
If you work on a Swift project that follows the Model-View-ViewModel (MVVM) architecture or similar, you may want to jump to counterpart in Xcode from your view to your model, and then to your view model. (ie. by using Ctrl+Cmd+Up and Ctrl+Cmd+Down).
You can do this in recent versions of Xcode by setting a configuration default.
From a terminal, just type this command and press Enter:
defaults write com.apple.dt.Xcode IDEAdditionalCounterpartSuffixes -array-add "ViewModel" "View"
import UIKit | |
// Based on https://www.stephanboyer.com/post/132/what-are-covariance-and-contravariance | |
// > Denotes "a subtype of" | |
// UIButton > UIView > UIResponder > NSObject | |
// | |
// e.g. `UIButton` is a subtype of `UIView` | |
// | |
// This means that any function that takes a `UIView`, can receive a `UIButton`: | |
// |
Hello,
I attended WWDC this year, and overall it was a fantastic experience. I would, however, like to give some feedback on one particular aspect of the conference.
Before I begin, I understand that it would be easy to brush off my feedback as coming from just some grumpy English guy, but I genuinely believe this is important feedback. Please do read until the end.
I would like to ask that the cheering, whooping, clapping and hollering by conference staff is toned down.
I'm a person that would describe myself as "slightly introverted". I cannot begin to describe how deeply uncomfortable it was to walk into the registration room on Sunday to multiple employees cheering and clapping at me, trying to give me high fives. I understand the want to make people excited, but this needs to have its limits. During the conference, I got cheered and high-fived pretty much the entire week for things like:
/// `ObjectBinding` used as a way to create a `Binding` from a `BindableObject`. In this case the ViewModel | |
/// complies with `BindableObject` which is then translated into a `Binding` which is what `Toggle` is expecting | |
/// NOTE: Since it's a `DynamicViewProperty`, after its value is changed, the body will be updated. | |
class ViewModel: BindableObject { | |
let didChange = PassthroughSubject<ViewModel, Never>() | |
var isEnabled = false { | |
didSet { | |
didChange.send(self) |
simulatorsIdentifiers=$(instruments -s devices | | |
grep -o "iPhone .* (.*) \[.*\]" | #only iPhone | |
grep -o "\[.*\]" | #only UUID | |
sed "s/^\[\(.*\)\]$/\1/" | #remove square brackets | |
sed 's/^/"/;$!s/$/"/;$s/$/"/' | #add quotes | |
sed '$!s/$/,/' #add comma to separate each element | |
) | |
arrayOfSimulatorsIdentifiers=($(echo "$simulatorsIdentifiers" | tr ',' '\n')) |