[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-6864":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":23,"hasPages":23,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":36,"readmeContent":37,"aiSummary":38,"trendingCount":16,"starSnapshotCount":16,"syncStatus":18,"lastSyncTime":39,"discoverSource":40},6864,"DeviceKit","devicekit\u002FDeviceKit","devicekit","DeviceKit is a value-type replacement of UIDevice.","",null,"Swift",4713,463,72,53,0,1,2,7,4,30,"MIT License",false,"master",[26,27,28,29,30,31,32,33,34,35],"battery-level","battery-state","device","device-family","hacktoberfest","ios","simulator","swift","swiftpm","tvos","2026-06-12 02:01:31","\u003Cimg src=\"\u002FDeviceKit.svg\" height=\"128\">\n\n[![GitHub license](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-lightgrey.svg)](https:\u002F\u002Fraw.githubusercontent.com\u002Fdevicekit\u002FDeviceKit\u002Fmaster\u002FLICENSE)\n[![CocoaPods Compatible](https:\u002F\u002Fimg.shields.io\u002Fcocoapods\u002Fv\u002FDeviceKit.svg)](https:\u002F\u002Fcocoapods.org\u002Fpods\u002FDeviceKit)\n[![Carthage Compatible](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FCarthage-compatible-4BC51D.svg?style=flat)](https:\u002F\u002Fgithub.com\u002FCarthage\u002FCarthage)\n[![codecov](https:\u002F\u002Fcodecov.io\u002Fgh\u002Fdevicekit\u002FDeviceKit\u002Fbranch\u002Fmaster\u002Fgraph\u002Fbadge.svg)](https:\u002F\u002Fcodecov.io\u002Fgh\u002Fdevicekit\u002FDeviceKit)\n[![CocoaPods](https:\u002F\u002Fimg.shields.io\u002Fcocoapods\u002Fdt\u002FDeviceKit.svg)](https:\u002F\u002Fcocoapods.org\u002Fpods\u002FDeviceKit)\n[![Maintainability](https:\u002F\u002Fapi.codeclimate.com\u002Fv1\u002Fbadges\u002F844e23a17bde71ff6be1\u002Fmaintainability)](https:\u002F\u002Fcodeclimate.com\u002Fgithub\u002Fdevicekit\u002FDeviceKit\u002Fmaintainability)\n[![Platform](https:\u002F\u002Fimg.shields.io\u002Fcocoapods\u002Fp\u002FDeviceKit.svg?style=flat)](http:\u002F\u002Fcocoadocs.org\u002Fdocsets\u002FDeviceKit)\n\n\n| Branch | Versions |\n|:---------|:----------:|\n| **master** | ≥ 2.0 |\n| **Swift 4 - 4.2** | ≥ 1.3 \u003C 1.13 |\n| **Swift 3** | ≥ 1.0 \u003C 1.3 |\n| **Swift 2.3** | \u003C 1.0 |\n\n`DeviceKit` is a value-type replacement of [`UIDevice`](https:\u002F\u002Fdeveloper.apple.com\u002Flibrary\u002Fios\u002Fdocumentation\u002FUIKit\u002FReference\u002FUIDevice_Class\u002F).\n\n## Current version 5.8.0\nSee our detailed [changelog](CHANGELOG.md) for the latest features, improvements and bug fixes.\n\n## Features\n\n- [x] Equatable\n- [x] Device identification\n- [x] Device family detection\n- [x] Device group detection\n- [x] Simulator detection\n- [x] Battery state\n- [x] Battery level\n- [x] Various device metrics (e.g. screen size, screen ratio, PPI)\n- [x] Low Power Mode detection\n- [x] Guided Access Session detection\n- [x] Screen brightness\n- [x] Display Zoom detection\n- [x] Detect available sensors (Touch ID, Face ID)\n- [x] Detect available disk space\n- [x] Apple Pencil support detection\n\n## Requirements\n\n- iOS 11.0+\n- tvOS 11.0+\n- watchOS 4.0+\n\n## Installation\nDeviceKit can be installed in various ways.\n\n### CocoaPods\n\n#### Swift 5\n```ruby\npod 'DeviceKit', '~> 5.2'\n```\n#### iOS 8.0 support\n```ruby\npod 'DeviceKit', '3.2'\n```\n#### Swift 4.0 - Swift 4.2\n```ruby\npod 'DeviceKit', '~> 1.3'\n```\n#### Swift 3\n```ruby\npod 'DeviceKit', '~> 1.2.3'\n```\n#### Swift 2.3 (Unsupported)\n```ruby\npod 'DeviceKit', :git => 'https:\u002F\u002Fgithub.com\u002Fdevicekit\u002FDeviceKit.git', :branch => 'swift-2.3-unsupported'\n```\n\n### Swift Package Manager\n\n#### Swift 5\n```swift\ndependencies: [\n    .package(url: \"https:\u002F\u002Fgithub.com\u002Fdevicekit\u002FDeviceKit.git\", from: \"4.0.0\"),\n    \u002F\u002F\u002F ...\n]\n```\n#### iOS 8.0 support\n```swift\ndependencies: [\n    .package(url: \"https:\u002F\u002Fgithub.com\u002Fdevicekit\u002FDeviceKit.git\", from: \"3.2.0\"),\n    \u002F\u002F\u002F ...\n]\n```\n\n### Carthage\n\n#### Swift 5\n```ogdl\ngithub \"devicekit\u002FDeviceKit\" ~> 4.0\n```\n#### iOS 8.0 support\n```ogdl\ngithub \"devicekit\u002FDeviceKit\" ~> 3.2\n```\n#### Swift 4.0 - Swift 4.2\n```ogdl\ngithub \"devicekit\u002FDeviceKit\" ~> 1.3\n```\n#### Swift 3\n```ogdl\ngithub \"devicekit\u002FDeviceKit\" ~> 1.2.3\n```\n#### Swift 2.3 (Unsupported)\n```ogdl\ngithub \"devicekit\u002FDeviceKit\" \"swift-2.3-unsupported\"\n```\n\n### Manually\nTo install it manually, drag the `DeviceKit` project into your app project in Xcode. Or add it as a git submodule by running:\n```bash\n$ git submodule add https:\u002F\u002Fgithub.com\u002Fdevicekit\u002FDeviceKit.git\n```\n\n## Usage\nFirst make sure to import the framework:\n```swift\nimport DeviceKit\n```\n\nHere are some usage examples. All devices are also available as simulators:\n```swift\n.iPhone6 => .simulator(.iPhone6)\n.iPhone6s => .simulator(.iPhone6s)\n```\n\nYou can try these examples in Playground.\n\n**Note:**\n\n> To try DeviceKit in the playground, open the `DeviceKit.xcworkspace` and build DeviceKit.framework for any simulator first by selecting \"DeviceKit\" as your current scheme.\n\n### Get the Device You're Running On\n```swift\nlet device = Device.current\n\nprint(device)     \u002F\u002F prints, for example, \"iPhone 6 Plus\"\n\nif device == .iPhone6Plus {\n  \u002F\u002F Do something\n} else {\n  \u002F\u002F Do something else\n}\n```\n\n### Get the Device Family\n```swift\nlet device = Device.current\nif device.isPod {\n  \u002F\u002F iPods (real or simulator)\n} else if device.isPhone {\n  \u002F\u002F iPhone (real or simulator)\n} else if device.isPad {\n  \u002F\u002F iPad (real or simulator)\n}\n```\n\n### Check If Running on Simulator\n```swift\nlet device = Device.current\nif device.isSimulator {\n  \u002F\u002F Running on one of the simulators(iPod\u002FiPhone\u002FiPad)\n  \u002F\u002F Skip doing something irrelevant for Simulator\n} \n```\n\n### Get the Simulator Device\n```swift\nlet device = Device.current\nswitch device {\ncase .simulator(.iPhone6s): break \u002F\u002F You're running on the iPhone 6s simulator\ncase .simulator(.iPadAir2): break \u002F\u002F You're running on the iPad Air 2 simulator\ndefault: break\n}\n```\n \n### Make Sure the Device Is Contained in a Preconfigured Group\n```swift\nlet groupOfAllowedDevices: [Device] = [.iPhone6, .iPhone6Plus, .iPhone6s, .iPhone6sPlus, .simulator(.iPhone6), .simulator(.iPhone6Plus),.simulator(.iPhone6s),.simulator(.iPhone6sPlus).simulator(.iPhone8),.simulator(.iPhone8Plus),.simulator(.iPhoneX),.simulator(.iPhoneXS),.simulator(.iPhoneXSMax),.simulator(.iPhoneXR)]\n\nlet device = Device.current\n \nif device.isOneOf(groupOfAllowedDevices) {\n  \u002F\u002F Do your action\n}\n```\n\n### Get the Current Battery State\n**Note:**\n\n> To get the current battery state we need to set `UIDevice.current.isBatteryMonitoringEnabled` to `true`. To avoid any issues with your code, we read the current setting and reset it to what it was before when we're done.\n\n```swift\nif device.batteryState == .full || device.batteryState >= .charging(75) {\n  print(\"Your battery is happy! 😊\")\n}\n```\n\n### Get the Current Battery Level\n```swift\nif device.batteryLevel >= 50 {\n  install_iOS()\n} else {\n  showError()\n}\n```\n\n### Get Low Power mode status\n```swift\nif device.batteryState.lowPowerMode {\n  print(\"Low Power mode is enabled! 🔋\")\n} else {\n  print(\"Low Power mode is disabled! 😊\")\n}\n```\n\n### Check if a Guided Access session is currently active\n```swift\nif device.isGuidedAccessSessionActive {\n  print(\"Guided Access session is currently active\")\n} else {\n  print(\"No Guided Access session is currently active\")\n}\n```\n\n### Get Screen Brightness\n```swift\nif device.screenBrightness > 50 {\n  print(\"Take care of your eyes!\")\n}\n```\n\n### Get Available Disk Space\n```swift\nif Device.volumeAvailableCapacityForOpportunisticUsage ?? 0 > Int64(1_000_000) {\n  \u002F\u002F download that nice-to-have huge file\n}\n\nif Device.volumeAvailableCapacityForImportantUsage ?? 0 > Int64(1_000) {\n  \u002F\u002F download that file you really need\n}\n```\n\n## Source of Information\nAll model identifiers are taken from the following website: https:\u002F\u002Fwww.theiphonewiki.com\u002Fwiki\u002FModels or extracted from the simulator app bundled with Xcode.\n\n## Contributing\nIf you have the need for a specific feature that you want implemented or if you experienced a bug, please open an issue.\nIf you extended the functionality of DeviceKit yourself and want others to use it too, please submit a pull request.\n\n## Contributors\nThe complete list of people who contributed to this project is available [here](https:\u002F\u002Fgithub.com\u002Fdevicekit\u002FDeviceKit\u002Fgraphs\u002Fcontributors). DeviceKit wouldn't be what it is without you! Thank you very much! 🙏\n","DeviceKit 是一个用于替代 UIDevice 的值类型库。它提供了设备识别、设备家族检测、模拟器检测、电池状态与电量查询、屏幕尺寸及分辨率等设备信息获取功能，并支持低电量模式、辅助访问会话检测等功能。该库使用 Swift 编写，具有良好的可维护性和跨平台兼容性（iOS 11.0+、tvOS 11.0+）。适用于需要在 iOS 或 tvOS 应用中获取详细设备信息的场景，如根据设备类型调整应用布局或基于电池状态优化性能。","2026-06-11 03:09:17","top_language"]