Single device definition - Grubas7/AGSnapshotHelper GitHub Wiki
Introduction
Motivation
- Device definition object must allow to set device UI specific properties
- size
- safeAreaInsets
- layoutMargins
- horizontalSizeClass
- verticalSizeClass
- preferredContentSizeCategory
- layoutDirection
- directionalLayoutMargins
- ?
- Single device must be accessible for Swift and Objective-C
- New device definition can be created at any time outside library (no needs to update library in case of new device release)
Proposed solution:
Use NSObject subclass with DeviceViewMockable protocol conformance
class Phone_4Inches: NSObject, DeviceViewMockable {
var name = "iPhone SE"
var size = .init(width: 320.0, height: 568.0)
var layoutMargins = .init(top: 8.0, left: 16.0, bottom: 8.0, right: 16.0)
...
}