Skip to content

Commit

Permalink
Merge pull request #58 from mitchtreece/dev
Browse files Browse the repository at this point in the history
3.7.0 Release
  • Loading branch information
mitchtreece authored Sep 30, 2024
2 parents 6cf7697 + c2b85d4 commit 684c72d
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<div align="center">

![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)
Expand Down
70 changes: 65 additions & 5 deletions Sources/Core/AppleDevice/AppleDevice+DeviceType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -126,6 +130,7 @@ public extension AppleDevice /* Device Type */ {
case appleWatchUltra
case appleWatchS9
case appleWatchUltra_2
case appleWatchS10

case appleTV
case appleTV_2
Expand All @@ -147,6 +152,7 @@ public extension AppleDevice /* Device Type */ {
case airpodsPro
case airpodsMax
case airpodsPro_2
case airpods_4

case homepod
case homepodMini
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -1172,24 +1218,38 @@ 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:

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:

releaseYear = 2022
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
Expand Down
3 changes: 3 additions & 0 deletions Sources/Core/AppleDevice/AppleDevice.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
62 changes: 62 additions & 0 deletions Sources/UI/SwiftUI/Modifiers/ConditionalPaddingModifier.swift
Original file line number Diff line number Diff line change
@@ -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
))

}

}

0 comments on commit 684c72d

Please sign in to comment.