Skip to content

Commit 0e7c312

Browse files
authored
Add new snapshot devices (#61)
* Add new snapshot devices * Format
1 parent 98c0428 commit 0e7c312

File tree

1 file changed

+214
-1
lines changed

1 file changed

+214
-1
lines changed

Sources/Playbook/SnapshotSupport/SnapshotDevice.swift

Lines changed: 214 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,129 @@ public extension SnapshotDevice {
524524
}
525525
}
526526

527+
/// iPhone 13 Series
528+
public extension SnapshotDevice {
529+
/// `iPhone 13 mini` simulated device.
530+
///
531+
/// - Parameters:
532+
/// - orientation: A simulated orientation.
533+
///
534+
/// - Returns: A device simulated the `iPhone 13 mini`.
535+
static func iPhone13Mini(_ orientation: Orientation) -> SnapshotDevice {
536+
SnapshotDevice(
537+
name: "iPhone 13 mini \(orientation.string)",
538+
size: orientation.use(
539+
portrait: CGSize(width: 375, height: 812),
540+
landscape: CGSize(width: 812, height: 375)
541+
),
542+
safeAreaInsets: orientation.use(
543+
portrait: UIEdgeInsets(top: 50, left: 0, bottom: 34, right: 0),
544+
landscape: UIEdgeInsets(top: 0, left: 50, bottom: 21, right: 50)
545+
),
546+
traitCollection: UITraitCollection(
547+
userInterfaceIdiom: .phone,
548+
displayScale: 3,
549+
displayGamut: .P3,
550+
horizontalSizeClass: .compact,
551+
verticalSizeClass: orientation.use(portrait: .regular, landscape: .compact),
552+
layoutDirection: .leftToRight,
553+
forceTouchCapability: .unavailable,
554+
preferredContentSizeCategory: .medium
555+
)
556+
)
557+
}
558+
559+
/// `iPhone 13` simulated device.
560+
///
561+
/// - Parameters:
562+
/// - orientation: A simulated orientation.
563+
///
564+
/// - Returns: A device simulated the `iPhone 13`.
565+
static func iPhone13(_ orientation: Orientation) -> SnapshotDevice {
566+
SnapshotDevice(
567+
name: "iPhone 13 \(orientation.string)",
568+
size: orientation.use(
569+
portrait: CGSize(width: 390, height: 844),
570+
landscape: CGSize(width: 844, height: 390)
571+
),
572+
safeAreaInsets: orientation.use(
573+
portrait: UIEdgeInsets(top: 47, left: 0, bottom: 34, right: 0),
574+
landscape: UIEdgeInsets(top: 0, left: 47, bottom: 21, right: 47)
575+
),
576+
traitCollection: UITraitCollection(
577+
userInterfaceIdiom: .phone,
578+
displayScale: 3,
579+
displayGamut: .P3,
580+
horizontalSizeClass: .compact,
581+
verticalSizeClass: orientation.use(portrait: .regular, landscape: .compact),
582+
layoutDirection: .leftToRight,
583+
forceTouchCapability: .unavailable,
584+
preferredContentSizeCategory: .medium
585+
)
586+
)
587+
}
588+
589+
/// `iPhone 13 Pro` simulated device.
590+
///
591+
/// - Parameters:
592+
/// - orientation: A simulated orientation.
593+
///
594+
/// - Returns: A device simulated the `iPhone 13 Pro`.
595+
static func iPhone13Pro(_ orientation: Orientation) -> SnapshotDevice {
596+
SnapshotDevice(
597+
name: "iPhone 13 Pro \(orientation.string)",
598+
size: orientation.use(
599+
portrait: CGSize(width: 390, height: 844),
600+
landscape: CGSize(width: 844, height: 390)
601+
),
602+
safeAreaInsets: orientation.use(
603+
portrait: UIEdgeInsets(top: 47, left: 0, bottom: 34, right: 0),
604+
landscape: UIEdgeInsets(top: 0, left: 47, bottom: 21, right: 47)
605+
),
606+
traitCollection: UITraitCollection(
607+
userInterfaceIdiom: .phone,
608+
displayScale: 3,
609+
displayGamut: .P3,
610+
horizontalSizeClass: .compact,
611+
verticalSizeClass: orientation.use(portrait: .regular, landscape: .compact),
612+
layoutDirection: .leftToRight,
613+
forceTouchCapability: .unavailable,
614+
preferredContentSizeCategory: .medium
615+
)
616+
)
617+
}
618+
619+
/// `iPhone 13 Pro Max` simulated device.
620+
///
621+
/// - Parameters:
622+
/// - orientation: A simulated orientation.
623+
///
624+
/// - Returns: A device simulated the `iPhone 13 Pro Max`.
625+
static func iPhone13ProMax(_ orientation: Orientation) -> SnapshotDevice {
626+
SnapshotDevice(
627+
name: "iPhone 13 Pro Max \(orientation.string)",
628+
size: orientation.use(
629+
portrait: CGSize(width: 428, height: 926),
630+
landscape: CGSize(width: 926, height: 428)
631+
),
632+
safeAreaInsets: orientation.use(
633+
portrait: UIEdgeInsets(top: 47, left: 0, bottom: 34, right: 0),
634+
landscape: UIEdgeInsets(top: 0, left: 47, bottom: 21, right: 47)
635+
),
636+
traitCollection: UITraitCollection(
637+
userInterfaceIdiom: .phone,
638+
displayScale: 3,
639+
displayGamut: .P3,
640+
horizontalSizeClass: orientation.use(portrait: .compact, landscape: .regular),
641+
verticalSizeClass: orientation.use(portrait: .regular, landscape: .compact),
642+
layoutDirection: .leftToRight,
643+
forceTouchCapability: .unavailable,
644+
preferredContentSizeCategory: .medium
645+
)
646+
)
647+
}
648+
}
649+
527650
/// iPhone 14 Series
528651
public extension SnapshotDevice {
529652
/// `iPhone 14 Pro` simulated device.
@@ -587,7 +710,70 @@ public extension SnapshotDevice {
587710
}
588711
}
589712

590-
/// iPad Mini 5th
713+
/// iPhone 15 Series
714+
public extension SnapshotDevice {
715+
/// `iPhone 15 Pro` simulated device.
716+
///
717+
/// - Parameters:
718+
/// - orientation: A simulated orientation.
719+
///
720+
/// - Returns: A device simulated the `iPhone 15 Pro`.
721+
static func iPhone15Pro(_ orientation: Orientation) -> SnapshotDevice {
722+
SnapshotDevice(
723+
name: "iPhone 15 Pro \(orientation.string)",
724+
size: orientation.use(
725+
portrait: CGSize(width: 393, height: 852),
726+
landscape: CGSize(width: 852, height: 393)
727+
),
728+
safeAreaInsets: orientation.use(
729+
portrait: UIEdgeInsets(top: 59, left: 0, bottom: 34, right: 0),
730+
landscape: UIEdgeInsets(top: 0, left: 59, bottom: 21, right: 59)
731+
),
732+
traitCollection: UITraitCollection(
733+
userInterfaceIdiom: .phone,
734+
displayScale: 3,
735+
displayGamut: .P3,
736+
horizontalSizeClass: .compact,
737+
verticalSizeClass: orientation.use(portrait: .regular, landscape: .compact),
738+
layoutDirection: .leftToRight,
739+
forceTouchCapability: .unavailable,
740+
preferredContentSizeCategory: .medium
741+
)
742+
)
743+
}
744+
745+
/// `iPhone 15 Pro Max` simulated device.
746+
///
747+
/// - Parameters:
748+
/// - orientation: A simulated orientation.
749+
///
750+
/// - Returns: A device simulated the `iPhone 15 Pro Max`.
751+
static func iPhone15ProMax(_ orientation: Orientation) -> SnapshotDevice {
752+
SnapshotDevice(
753+
name: "iPhone 15 Pro Max \(orientation.string)",
754+
size: orientation.use(
755+
portrait: CGSize(width: 430, height: 932),
756+
landscape: CGSize(width: 932, height: 430)
757+
),
758+
safeAreaInsets: orientation.use(
759+
portrait: UIEdgeInsets(top: 59, left: 0, bottom: 34, right: 0),
760+
landscape: UIEdgeInsets(top: 0, left: 59, bottom: 21, right: 59)
761+
),
762+
traitCollection: UITraitCollection(
763+
userInterfaceIdiom: .phone,
764+
displayScale: 3,
765+
displayGamut: .P3,
766+
horizontalSizeClass: orientation.use(portrait: .compact, landscape: .regular),
767+
verticalSizeClass: orientation.use(portrait: .regular, landscape: .compact),
768+
layoutDirection: .leftToRight,
769+
forceTouchCapability: .unavailable,
770+
preferredContentSizeCategory: .medium
771+
)
772+
)
773+
}
774+
}
775+
776+
/// iPad Mini
591777
public extension SnapshotDevice {
592778
/// `iPad Mini 5th generation` simulated device.
593779
///
@@ -615,6 +801,33 @@ public extension SnapshotDevice {
615801
)
616802
)
617803
}
804+
805+
/// `iPad Mini 6th generation` simulated device.
806+
///
807+
/// - Parameters:
808+
/// - orientation: A simulated orientation.
809+
///
810+
/// - Returns: A device simulated the `iPad Mini 6th generation`.
811+
static func iPadMini6th(_ orientation: Orientation) -> SnapshotDevice {
812+
SnapshotDevice(
813+
name: "iPad mini 6th \(orientation.string)",
814+
size: orientation.use(
815+
portrait: CGSize(width: 744, height: 1133),
816+
landscape: CGSize(width: 1133, height: 744)
817+
),
818+
safeAreaInsets: UIEdgeInsets(top: 24, left: 20, bottom: 24, right: 20),
819+
traitCollection: UITraitCollection(
820+
userInterfaceIdiom: .pad,
821+
displayScale: 2,
822+
displayGamut: .SRGB,
823+
horizontalSizeClass: .regular,
824+
verticalSizeClass: .regular,
825+
layoutDirection: .leftToRight,
826+
forceTouchCapability: .unavailable,
827+
preferredContentSizeCategory: .medium
828+
)
829+
)
830+
}
618831
}
619832

620833
/// iPad Pro

0 commit comments

Comments
 (0)