Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: CI

on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]

jobs:
build-ios:
name: Build iOS
runs-on: macos-15
steps:
- uses: actions/checkout@v4

- name: Build iOS Framework
run: |
xcodebuild build \
-scheme SDiOSVersion \
-destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' \
-project SDVersion-Demo/SDVersion.xcodeproj \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
| xcpretty || true

build-macos:
name: Build macOS
runs-on: macos-15
steps:
- uses: actions/checkout@v4

- name: Build macOS Framework
run: |
xcodebuild build \
-scheme SDMacVersion \
-destination 'platform=macOS' \
-project SDVersion-Demo/SDVersion.xcodeproj \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
| xcpretty || true

build-tvos:
name: Build tvOS
runs-on: macos-15
steps:
- uses: actions/checkout@v4

- name: Build tvOS Framework
run: |
xcodebuild build \
-scheme SDtvOSVersion \
-destination 'platform=tvOS Simulator,name=Apple TV,OS=latest' \
-project SDVersion-Demo/SDVersion.xcodeproj \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
| xcpretty || true

build-watchos:
name: Build watchOS
runs-on: macos-15
steps:
- uses: actions/checkout@v4

- name: Build watchOS Framework
run: |
xcodebuild build \
-scheme SDwatchOSVersion \
-destination 'platform=watchOS Simulator,name=Apple Watch Series 10 (46mm),OS=latest' \
-project SDVersion-Demo/SDVersion.xcodeproj \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
| xcpretty || true

build-spm:
name: Build Swift Package
runs-on: macos-15
steps:
- uses: actions/checkout@v4

- name: Build Package (macOS)
run: swift build --target SDMacVersion

pod-lint:
name: CocoaPods Lint
runs-on: macos-15
steps:
- uses: actions/checkout@v4

- name: Lint Podspec
run: pod lib lint --allow-warnings
43 changes: 34 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Xcode
#
build/
*.pbxuser
!default.pbxuser
Expand All @@ -9,22 +8,48 @@ build/
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
xcuserdata/
*.xccheckout
*.moved-aside
DerivedData
DerivedData/
*.hmap
*.ipa
*.xcuserstate
*.xcscmblueprint

# macOS
.DS_Store
.AppleDouble
.LSOverride
._*

# Swift Package Manager
.build/
.swiftpm/
Package.resolved
SourcePackages/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control?
#
# Pods/
Pods/
*.xcworkspace

# Carthage
Carthage/Build/
Carthage/Checkouts/

# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output/

# Code Injection
iOSInjectionProject/

# Playgrounds
timeline.xctimeline
playground.xcworkspace

# Accio dependency management
Dependencies/
.accio/
84 changes: 84 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Changelog

All notable changes to SDVersion will be documented in this file.

## [5.0.0] - 2025-01-01

### Breaking Changes
- **Minimum deployment targets updated:**
- iOS: 7.0 -> 13.0
- macOS: 10.9 -> 11.0
- watchOS: 2.0 -> 6.0
- tvOS: 9.0 -> 13.0
- Device enum values have been reorganized with new integer assignments
- Some legacy device enum names have been updated for consistency

### Added

#### iOS Devices
- iPhone XS, XS Max, XR (2018)
- iPhone 11, 11 Pro, 11 Pro Max (2019)
- iPhone SE (2nd generation), iPhone 12 mini/12/12 Pro/12 Pro Max (2020)
- iPhone 13 mini/13/13 Pro/13 Pro Max (2021)
- iPhone SE (3rd generation), iPhone 14/14 Plus/14 Pro/14 Pro Max (2022)
- iPhone 15/15 Plus/15 Pro/15 Pro Max (2023)
- iPhone 16/16 Plus/16 Pro/16 Pro Max (2024)
- iPhone 16e (2025)

#### iPad Devices
- iPad (6th-10th generation)
- iPad Pro 11-inch (1st-4th generation)
- iPad Pro 12.9-inch (3rd-6th generation)
- iPad Pro 11-inch M4, iPad Pro 13-inch M4 (2024)
- iPad Air (3rd-5th generation)
- iPad Air 11-inch M2, iPad Air 13-inch M2 (2024)
- iPad mini (5th-7th generation)

#### iPod Devices
- iPod touch (7th generation)

#### Apple Watch Models
- Apple Watch Series 4, 5, 6, 7, 8, 9, 10
- Apple Watch SE (1st and 2nd generation)
- Apple Watch Ultra, Ultra 2
- New screen sizes: 40mm, 41mm, 44mm, 45mm, 46mm, 49mm

#### Apple TV Models
- Apple TV 4K (2nd generation)
- Apple TV 4K (3rd generation)

#### Mac Models
- Mac Studio (M1 Max, M1 Ultra, M2 Max, M2 Ultra)
- Mac Pro (M2 Ultra)
- iMac 24-inch (M1, M3, M4)
- Mac mini (M1, M2, M2 Pro, M4, M4 Pro)
- MacBook Air (M1, M2, M3)
- MacBook Pro 13-inch (M1, M2)
- MacBook Pro 14-inch (M1 Pro/Max, M2 Pro/Max, M3/Pro/Max, M4/Pro/Max)
- MacBook Pro 16-inch (M1 Pro/Max, M2 Pro/Max, M3 Pro/Max, M4 Pro/Max)

#### New Screen Sizes
- iPhone: 5.4", 6.1", 6.3", 6.5", 6.7", 6.9"
- Apple Watch: 40mm, 41mm, 44mm, 45mm, 46mm, 49mm
- Mac: 14", 16"

#### New macOS Features
- `isAppleSilicon` - Check if running on Apple Silicon
- `chipType` - Get the specific chip (M1, M1 Pro, M2, etc.)
- `chipName` - Get human-readable chip name
- `DeviceVersionMacStudio` - New device type for Mac Studio
- `ChipType` enum for all Apple Silicon variants

### Infrastructure
- Added Swift Package Manager support (`Package.swift`)
- Added Privacy Manifest (`PrivacyInfo.xcprivacy`) for App Store compliance
- Added GitHub Actions CI/CD workflow
- Updated `.gitignore` for modern Xcode and SPM
- Added `CONTRIBUTING.md` with guidelines for adding new devices

### Fixed
- Apple Silicon simulator detection (arm64)
- Screen size detection for notched and Dynamic Island iPhones

## [4.3.2] - Previous Release
- Last release before 5.0.0 modernization
73 changes: 73 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Contributing to SDVersion

Thank you for your interest in contributing to SDVersion! This document provides guidelines for contributing.

## Adding New Device Support

When Apple releases new devices, SDVersion needs to be updated. Here's how:

### Finding Device Identifiers

Device identifiers (machine IDs) can be found from these sources:
- [The Apple Wiki - Models](https://theapplewiki.com/wiki/Models)
- [EveryMac](https://everymac.com)
- [AppleDB](https://appledb.dev)
- [adamawolf's gist](https://gist.github.com/adamawolf/3048717)

### Adding a New iPhone/iPad

1. **Update `SDiOSVersion.h`:**
- Add a new enum value in the appropriate year section
- Use the next available integer value in that section

2. **Update `SDiOSVersion.m`:**
- Add the device identifier mapping in `deviceNamesByCode`
- Add the display name in `deviceNameForVersion:`

3. **Update screen size detection if needed:**
- If the device has a new screen resolution, update `resolutionSize`

### Adding a New Apple Watch

1. **Update `SDwatchOSVersion.h`:**
- Add enum values for each size variant

2. **Update `SDwatchOSVersion.m`:**
- Add identifier mappings
- Update display names
- Update screen size detection if new sizes are introduced

### Adding a New Mac

1. **Update `SDMacVersion.h`:**
- Add new ChipType if applicable (M5, etc.)

2. **Update `SDMacVersion.m`:**
- Add model detection in `deviceInformationForModel:`
- Map to appropriate device version and chip type

## Code Style

- Follow existing Objective-C conventions in the codebase
- Use 4-space indentation
- Keep device mappings alphabetically organized by identifier
- Group devices by year in comments

## Testing

Before submitting a PR:
1. Ensure the project builds on all platforms (iOS, macOS, watchOS, tvOS)
2. Test with the simulator for new devices if available
3. Run `pod lib lint` to validate the podspec

## Pull Request Process

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/add-iphone-17`)
3. Commit your changes with clear messages
4. Update the CHANGELOG.md
5. Submit a pull request

## Questions?

Open an issue for discussion before making large changes.
63 changes: 63 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// swift-tools-version:5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "SDVersion",
platforms: [
.iOS(.v13),
.macOS(.v11),
.tvOS(.v13),
.watchOS(.v6)
],
products: [
// Platform-specific libraries - use the one matching your target platform
.library(
name: "SDiOSVersion",
targets: ["SDiOSVersion"]
),
.library(
name: "SDMacVersion",
targets: ["SDMacVersion"]
),
.library(
name: "SDwatchOSVersion",
targets: ["SDwatchOSVersion"]
),
.library(
name: "SDtvOSVersion",
targets: ["SDtvOSVersion"]
)
],
targets: [
.target(
name: "SDiOSVersion",
dependencies: [],
path: "SDVersion/SDiOSVersion",
resources: [.process("../PrivacyInfo.xcprivacy")],
publicHeadersPath: "."
),
.target(
name: "SDMacVersion",
dependencies: [],
path: "SDVersion/SDMacVersion",
resources: [.process("../PrivacyInfo.xcprivacy")],
publicHeadersPath: "."
),
.target(
name: "SDwatchOSVersion",
dependencies: [],
path: "SDVersion/SDwatchOSVersion",
resources: [.process("../PrivacyInfo.xcprivacy")],
publicHeadersPath: "."
),
.target(
name: "SDtvOSVersion",
dependencies: [],
path: "SDVersion/SDtvOSVersion",
resources: [.process("../PrivacyInfo.xcprivacy")],
publicHeadersPath: "."
)
]
)
Loading