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
// Request | |
UIAccessibility.post(notification: .layoutChanged, | |
argument: "Loading job list.") | |
spinner.isHidden = false | |
service.getJobList() { [weak self] result in | |
self?.spinner.isHidden = true | |
switch result { | |
case .success(let jobs): | |
self?.jobList = jobs | |
self?.tableView.reloadData() |
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
// UICollectionViewCell | |
isAccessibilityElement = true | |
accessibilityTraits = .button | |
accessibilityLabel = "\(job.title). \(L10n.jobLocation): \(job.location)" | |
accessibilityHint = L10n.jobCellHint |
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
view.accessibilityIgnoresInvertColors = true |
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
// UILabel | |
label.font = .preferredFont(forTextStyle: .headline) | |
label.adjustsFontForContentSizeCategory = true | |
// UIImageView | |
imageView.adjustsImageSizeForAccessibilityContentSizeCategory = true |
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
lazy var persistentContainer: NSPersistentContainer = { | |
let container = NSPersistentContainer(name: "CoreDataExample") | |
container.loadPersistentStores(completionHandler: { (storeDescription, error) in | |
if let error = error as NSError? { | |
fatalError("Unresolved error \(error), \(error.userInfo)") | |
} | |
}) | |
return container | |
}() |
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 customerList = Customer.fetchAll() |
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 customer = Customer() | |
customer.name = "Mike" | |
customer.email = "mike@gmail.com" | |
customer.password = "mike123" |
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 | |
import CoreData | |
@objc(Customer) | |
class Customer: CustomNSManagedObject, FetchableProtocol { | |
@NSManaged var name: String | |
@NSManaged var email: String | |
@NSManaged var password: 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
import Foundation | |
import CoreData | |
protocol FetchableProtocol: class { | |
associatedtype FetchableType: NSManagedObject = Self | |
} | |
extension FetchableProtocol where Self : NSManagedObject, FetchableType == Self { | |
static func fetchAll() -> [FetchableType] { |
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 | |
protocol DescribeProtocol: class { } | |
extension DescribeProtocol where Self: NSObject { | |
static var objectName: String { | |
return String(describing: self) | |
} | |
} |
NewerOlder