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
class EnumeratedStateViewModel { | |
public let state: Observable<State> | |
enum State: Equatable { | |
case initial | |
case loading | |
case loaded(UIImage) | |
case empty(String) | |
case error(String) |
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
class StructStateViewModel { | |
public let state: Observable<State> | |
struct State { | |
var id: String? | |
var loading = false | |
var image: UIImage? | |
var empty: String? | |
var error: String? |
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
class MVVMViewController: UIViewController { | |
@IBOutlet weak var firstNameLabel: UILabel! | |
@IBOutlet weak var lastNameLabel: UILabel! | |
@IBOutlet weak var addressLabel: UILabel! | |
@IBOutlet weak var cityLabel: UILabel! | |
@IBOutlet weak var stateLabel: UILabel! | |
@IBOutlet weak var zipLabel: UILabel! | |
private var viewModel = MyViewModel() |
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
class RxSwiftViewController: UIViewController { | |
@IBOutlet weak var firstNameLabel: UILabel! | |
@IBOutlet weak var lastNameLabel: UILabel! | |
@IBOutlet weak var addressLabel: UILabel! | |
@IBOutlet weak var cityLabel: UILabel! | |
@IBOutlet weak var stateLabel: UILabel! | |
@IBOutlet weak var zipLabel: UILabel! | |
private var viewModel = MyViewModel() |
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
import 'package:flutter/material.dart'; | |
import 'package:test_app/models/commodities_model.dart'; | |
class CommodityPicker extends StatelessWidget { | |
CommodityPicker(this.commodityMap, this.selected); | |
final Map<String, Commodity> commodityMap; // VM | |
final String selected; // VM | |
@override | |
Widget build(BuildContext context) { |
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
func load() { | |
DispatchQueue.global(qos: .utility).async { | |
let result = self.makeAPICall() | |
DispatchQueue.main.async { | |
switch result { | |
case let .success(data): | |
print(data) | |
case let .failure(error): | |
print(error) |
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
func simulateAnotherCall(_ param: String?) -> Result<String?, NWError> { | |
return makeAPICall() | |
} | |
func load() { | |
DispatchQueue.global(qos: .utility).async { | |
// make first api call and flatMap second and third api calls | |
let result = self.apiTest() | |
.flatMap { self.simulateAnotherCall($0) } | |
.flatMap { self.simulateAnotherCall($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
struct A11yModifier: ViewModifier { | |
///A label that is visible to UI tests AND VoiceOver | |
let label: String? | |
///An identifier that is visible to UI tests NOT VoicOver | |
let identifier: String? | |
///The required function that returns our View with the necessary accessibility modifiers | |
func body(content: Content) -> some View { | |
content | |
.conditionalModifier(label != nil) { | |
$0.accessibility(label: Text(label!)) |
OlderNewer