From 51fa9921f0df8670570f4008e1213bd2480e01bc Mon Sep 17 00:00:00 2001 From: Mitch Treece Date: Mon, 10 Jun 2024 21:40:23 -0700 Subject: [PATCH 1/3] Added ConditionalPaddingModifier --- .../ConditionalPaddingModifier.swift | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Sources/UI/SwiftUI/Modifiers/ConditionalPaddingModifier.swift diff --git a/Sources/UI/SwiftUI/Modifiers/ConditionalPaddingModifier.swift b/Sources/UI/SwiftUI/Modifiers/ConditionalPaddingModifier.swift new file mode 100644 index 0000000..7a6338f --- /dev/null +++ b/Sources/UI/SwiftUI/Modifiers/ConditionalPaddingModifier.swift @@ -0,0 +1,62 @@ +// +// ConditionalPaddingModifier.swift +// Espresso +// +// Created by Mitch Treece on 6/10/24. +// + +import SwiftUI + +public struct ConditionalPaddingModifier: ViewModifier { + + private let edges: SwiftUI.Edge.Set + private let length: CGFloat? + private let condition: Bool + + public init(edges: SwiftUI.Edge.Set, + length: CGFloat?, + condition: Bool) { + + self.edges = edges + self.length = length + self.condition = condition + + } + + public func body(content: Content) -> some View { + + if self.condition { + + return content.padding( + self.edges, + self.length + ) + .asAnyView() + + } + else { + + return content + .asAnyView() + + } + + } + +} + +public extension View { + + func conditionalPadding(_ edges: SwiftUI.Edge.Set = .all, + length: CGFloat? = nil, + condition: Bool) -> some View { + + modifier(ConditionalPaddingModifier( + edges: edges, + length: length, + condition: condition + )) + + } + +} From 007ec9d73c4af4a6864bc0083c85bba73e6d0da6 Mon Sep 17 00:00:00 2001 From: Mitch Treece Date: Sun, 29 Sep 2024 16:38:26 -0700 Subject: [PATCH 2/3] Added fall 2024 devices --- .../AppleDevice/AppleDevice+DeviceType.swift | 70 +++++++++++++++++-- Sources/Core/AppleDevice/AppleDevice.swift | 3 + 2 files changed, 68 insertions(+), 5 deletions(-) diff --git a/Sources/Core/AppleDevice/AppleDevice+DeviceType.swift b/Sources/Core/AppleDevice/AppleDevice+DeviceType.swift index 20a5a4f..e12b779 100644 --- a/Sources/Core/AppleDevice/AppleDevice+DeviceType.swift +++ b/Sources/Core/AppleDevice/AppleDevice+DeviceType.swift @@ -9,7 +9,7 @@ import Foundation // Device types are pulled from the following sources: // -// - https://www.theiphonewiki.com/wiki/Models +// - https://theapplewiki.com/wiki/Models // - https://gist.github.com/adamawolf/3048717 // // Or directly via Xcode's database: @@ -73,7 +73,11 @@ public extension AppleDevice /* Device Type */ { case iPhone15Plus case iPhone15Pro case iPhone15ProMax - + case iPhone16 + case iPhone16Plus + case iPhone16Pro + case iPhone16ProMax + case iPad case iPad2 case iPad_3 @@ -126,6 +130,7 @@ public extension AppleDevice /* Device Type */ { case appleWatchUltra case appleWatchS9 case appleWatchUltra_2 + case appleWatchS10 case appleTV case appleTV_2 @@ -147,6 +152,7 @@ public extension AppleDevice /* Device Type */ { case airpodsPro case airpodsMax case airpodsPro_2 + case airpods_4 case homepod case homepodMini @@ -578,6 +584,38 @@ public extension AppleDevice /* Device Type */ { marketingName = "iPhone 15 Pro Max" identifiers = ["iPhone16,2"] processor = .a17 + + case .iPhone16: + + releaseYear = 2024 + family = .iPhone + marketingName = "iPhone 16" + identifiers = ["iPhone17,3"] + processor = .a18 + + case .iPhone16Plus: + + releaseYear = 2024 + family = .iPhone + marketingName = "iPhone 16 Plus" + identifiers = ["iPhone17,4"] + processor = .a18 + + case .iPhone16Pro: + + releaseYear = 2024 + family = .iPhone + marketingName = "iPhone 16 Pro" + identifiers = ["iPhone17,1"] + processor = .a18Pro + + case .iPhone16ProMax: + + releaseYear = 2024 + family = .iPhone + marketingName = "iPhone 16 Pro Max" + identifiers = ["iPhone17,2"] + processor = .a18Pro // MARK: iPad @@ -1057,6 +1095,14 @@ public extension AppleDevice /* Device Type */ { identifiers = ["Watch7,5"] processor = .s9 + case .appleWatchS10: + + releaseYear = 2024 + family = .appleWatch + marketingName = "Apple Watch Series 10" + identifiers = ["Watch7,8", "Watch7,9", "Watch7,10", "Watch7,11"] + processor = .s10 + // MARK: Apple TV case .appleTV: @@ -1172,7 +1218,7 @@ public extension AppleDevice /* Device Type */ { releaseYear = 2019 family = .airPods marketingName = "AirPods Pro" - identifiers = ["iProd8,1", "AirPods2,2", "AirPodsPro1,1"] + identifiers = ["AirPods2,2", "AirPodsPro1,1", "iProd8,1"] processor = .h1 case .airpodsMax: @@ -1180,8 +1226,13 @@ public extension AppleDevice /* Device Type */ { releaseYear = 2020 family = .airPods marketingName = "AirPods Max" - identifiers = ["iProd8,6", "AirPodsMax1,1"] processor = .h1 + + identifiers = [ + "iProd8,6", // Lightning (2020) + "AirPodsMax1,1", // Lightning (2020) + "AirPodsMax1,2" // USB-C (2024) + ] case .airpodsPro_2: @@ -1189,7 +1240,16 @@ public extension AppleDevice /* Device Type */ { family = .airPods marketingName = "AirPods Pro" generationalName = "AirPods Pro (2nd Gen)" - identifiers = ["AirPodsPro1,2"] + identifiers = ["AirPodsPro1,2", "AirPodsPro2,1", "AirPods3,1"] + processor = .h2 + + case .airpods_4: + + releaseYear = 2024 + family = .airPods + marketingName = "AirPods" + generationalName = "AirPods (4th Gen)" + identifiers = ["AirPods1,4"] processor = .h2 // MARK: HomePod diff --git a/Sources/Core/AppleDevice/AppleDevice.swift b/Sources/Core/AppleDevice/AppleDevice.swift index c0c8f5e..9aaf2ef 100644 --- a/Sources/Core/AppleDevice/AppleDevice.swift +++ b/Sources/Core/AppleDevice/AppleDevice.swift @@ -125,6 +125,8 @@ public class AppleDevice { case a15 = "Apple A15 Bionic" case a16 = "Apple A16 Bionic" case a17 = "Apple A17 Pro" + case a18 = "Apple A18" + case a18Pro = "Apple A18 Pro" case m1 = "Apple M1" case m1Pro = "Apple M1 Pro" @@ -149,6 +151,7 @@ public class AppleDevice { case s7 = "Apple S7" case s8 = "Apple S8" case s9 = "Apple S9" + case s10 = "Apple S10" case w1 = "Apple W1" case h1 = "Apple H1" From c2b85d4b62c43ba25d17afba2e710f50f14b5610 Mon Sep 17 00:00:00 2001 From: Mitch Treece Date: Sun, 29 Sep 2024 17:00:51 -0700 Subject: [PATCH 3/3] Updated readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6a246fc..c260f66 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@
-![Version](https://img.shields.io/badge/Version-3.6.2-E0C39F.svg?style=for-the-badge&labelColor=AE7758) +![Version](https://img.shields.io/badge/Version-3.7.0-E0C39F.svg?style=for-the-badge&labelColor=AE7758) ![iOS](https://img.shields.io/badge/iOS-15+-E0C39F.svg?style=for-the-badge&labelColor=AE7758) ![macOS](https://img.shields.io/badge/macOS-13+-E0C39F.svg?style=for-the-badge&labelColor=AE7758) ![Swift](https://img.shields.io/badge/Swift-5.7-E0C39F.svg?style=for-the-badge&labelColor=AE7758)