Skip to content

Commit

Permalink
使用 Xcode 15.0 beta2 + Swift 5.9 編譯,新增 UIDevice+Extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
leoho0722 committed Jul 1, 2023
1 parent 847f09f commit 9ba0a15
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.8
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand Down
20 changes: 20 additions & 0 deletions Sources/TypeExtensionHelpers/UIDevice+Extensions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// UIDevice+Extensions.swift
// SwiftHelpers/TypeExtensionHelpers
//
// Created by Leo Ho on 2023/7/1.
//

import UIKit

public extension UIDevice {

var modelname: String {
var systemInfo = utsname()
uname(&systemInfo)
let name = withUnsafePointer(to: &systemInfo.machine.0) { ptr in
return String(cString: ptr)
}
return name
}
}

0 comments on commit 9ba0a15

Please sign in to comment.