Skip to content

Instantly share code, notes, and snippets.

View KaneCheshire's full-sized avatar

Kane Cheshire KaneCheshire

View GitHub Profile
manager.pausesLocationUpdatesAutomatically = false
manager.activityType = .automotiveNavigation
releaseConfig="Release"
if [ "$releaseConfig" = "${CONFIGURATION}" ]; then
if [ -z "$FASTLANE_LANE_NAME" ]; then
echo "error: This project cannot be archived manually. Releases should only be built using Fastlane."
exit -1
fi
fi
struct ExampleViewModel {
let title: String
let detail: String
let message: String
}
final class ExampleView: UIView {
import PixelTest
class DynamicTypeSnapshotTests: PixelTestCase {
override func setUp() {
super.setUp()
mode = .test
}
func test_simpleData() throws {
final class ExampleView: UIView {
@IBOutlet private var titleLabel: UILabel!
@IBOutlet private var detailLabel: UILabel!
@IBOutlet private var messageLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
setupDynamicType()
}
func test_extraSmallDynamicType() throws {
let view = ExampleView.loadFromNib()
let viewModel = ExampleViewModel(title: "A short title", detail: "A subtitle", message: "This is the message!")
let traitCollection = UITraitCollection(preferredContentSizeCategory: .extraSmall)
view.configure(with: viewModel, traitCollection: traitCollection)
try verify(view, layoutStyle: .dynamicHeight(fixedWidth: 320))
}
func test_accessibilityExtraExtraExtraLarge() throws {
let view = ExampleView.loadFromNib()
protocol CellDelegate: class {
func cellValueForToggle(_ cell: Cell) -> Bool
func cell(_ cell: Cell, didUpdateValueForToggle value: Bool)
}
class Cell: UITableViewCell {
weak var delegate: CellDelegate?
class ViewController: UIViewController, CellDelegate {
func cellValueForToggle(_ cell: Cell) -> Bool {
// Find the value for that cell somehow
}
func cell(_ cell: Cell, didUpdateValueForToggle value: Bool) {
// Update the value for that cell in your preferences
}
let settings = Settings()
var value: Bool = settings[keyPath: \Settings.prefersFahrenheit]
settings[keyPath: \Settings.prefersFahrenheit] = true