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
// | |
// ActivityPresentable.swift | |
// SnowMine | |
// | |
// Created by Majid Jabrayilov on 10/24/17. | |
// Copyright © 2017 SnowDog. All rights reserved. | |
// | |
import UIKit |
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 UIKit | |
class ItemsViewController: UIViewController { | |
@IBOutlet private weak var tableView: UITableView! | |
private var viewModel: ItemsViewModel | |
init(viewModel: ItemsViewModel) { | |
self.viewModel = viewModel | |
super.init(nibName: nil, bundle: nil) | |
} |
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 Foundation | |
class ItemsViewModel { | |
var items: [Item] = [] | |
var error: Error? | |
var refreshing = false | |
private let dataManager: DataManager | |
init(dataManager: DataManager) { | |
self.dataManager = dataManager |
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 ItemsViewController: UIViewController { | |
@IBOutlet private weak var tableView: UITableView! | |
private let activityIndicator = ActivityIndicatorView() | |
private var viewModel: ItemsViewModel | |
init(viewModel: ItemsViewModel) { | |
self.viewModel = viewModel | |
super.init(nibName: nil, bundle: nil) | |
} | |
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 Bond | |
class ItemsViewModel { | |
let items = Observable<[Item]>([]) | |
let error = Observable<Error?>(nil) | |
let refreshing = Observable<Bool>(false) | |
private let dataManager: DataManager | |
init(dataManager: DataManager) { | |
self.dataManager = dataManager |
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
let elements = statistics.enumerated().map { | |
let frame = CGRect(x: 0, y: CGFloat($0 * Layout.barHeight), width: bounds.width, height: Layout.barHeight) | |
let element = UIAccessibilityElement(accessibilityContainer: self) | |
element.accessibilityLabel = $1.time | |
element.accessibilityValue = "\(Int($1.value)), \($1.status)" | |
element.accessibilityFrameInContainerSpace = frame | |
return element | |
} | |
self.accessibilityElements = elements |
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
self.isAccessibilityElement = true | |
self.accessibilityLabel = "\(date), \(value) - \(status)" | |
self.accessibilityTraits |= UIAccessibilityTraitButton |
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 Bond | |
import ReactiveKit | |
class UserProfileViewModel { | |
let refreshing = Observable<Bool>(false) | |
let username = Observable<String>("") | |
let photos = Observable<[Photos]>([]) | |
private let userViewModel: UserViewModel | |
private let photosViewModel: PhotosViewModel |
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
protocol UIAccessibility: AnyObject { | |
var isAccessibilityElement: Bool { get set } | |
var accessibilityTraits: UIAccessibilityTraits { get set } | |
var accessibilityLabel: String? { get set } | |
var accessibilityValue: String? { get set } | |
} |
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 PresentationCell: UITableViewCell { | |
var viewModel: PresentationViewModel? { | |
didSet { | |
accessibilityLabel = viewModel?.label | |
accessibilityValue = viewModel?.value | |
} | |
} | |
override func awakeFromNib() { | |
super.awakeFromNib() |
OlderNewer