diff --git a/Demo/Demo.xcodeproj/project.pbxproj b/Demo/Demo.xcodeproj/project.pbxproj index e4849eb..ba532bf 100644 --- a/Demo/Demo.xcodeproj/project.pbxproj +++ b/Demo/Demo.xcodeproj/project.pbxproj @@ -411,7 +411,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 8G74YECJ4Z; INFOPLIST_FILE = Demo/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -431,7 +431,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 8G74YECJ4Z; INFOPLIST_FILE = Demo/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/Demo/Demo/ViewController.swift b/Demo/Demo/ViewController.swift index f621338..c954ee5 100644 --- a/Demo/Demo/ViewController.swift +++ b/Demo/Demo/ViewController.swift @@ -15,33 +15,39 @@ class ViewController: UITableViewController { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. - print( - "this is " + - "default".screen - .width(._320, is: "宽度 320") - .width(._375, is: "宽度 375") - .height(._844, is: "高度 844") - .height(._812, is: "高度 812") - .inch(._4_7, is: "4.7 英寸") - .inch(._5_8, is: "5.8 英寸") - .inch(._6_5, is: "6.5 英寸") - .level(.compact, is: "屏幕级别 紧凑屏") - .level(.regular, is: "屏幕级别 常规屏") - .level(.full, is: "屏幕级别 全面屏") - .value + print("this is " + "default".screen + .width(equalTo: 375, is: "宽度 等于 375") + .width(lessThan: 414, is: "宽度 小于 414") + .width(greaterThan: 414, is: "宽度 大于 414") + .height(equalTo: 700, is: "高度 等于 375") + .height(lessThan: 844, is: "高度 小于 844") + .height(greaterThan: 844, is: "高度 大于 844") + .inch(._4_7, is: "4.7 英寸") + .inch(._5_8, is: "5.8 英寸") + .inch(._6_5, is: "6.5 英寸") + .level(.compact, is: "屏幕级别 紧凑屏 (4:3)") + .level(.regular, is: "屏幕级别 常规屏 (16:9)") + .level(.full, is: "屏幕级别 全面屏 (19.5:9)") + .value ) + // Range用法: 默认值0, 当宽度小于等于375 返回1 + print(0.screen.width(...375, is: 1).value) + // Range用法: 默认值0, 当宽度为375至414范围时 返回1 + print(0.screen.width(375...414, is: 1).value) + // Range用法: 默认值0, 当屏幕小于5.5英寸时 返回1 + print(0.screen.inch(..<5.5, is: 1).value) // 默认值 0 在3.5英寸的屏幕时返回1, 在4.0英寸的屏幕时返回2 print(0.screen.inch(._3_5, is: 1).inch(._4_0, is: 2).value) // 默认值 0 在全面屏时返回1, 在6.1英寸的屏幕时返回2 print(0.screen.level(.full, is: 1).inch(._6_1, is: 2).value) // 默认值 100 在宽度为375级别的屏幕时 正常返回120, 如果为缩放模式则返回110 - print(100.screen.width(._375, is: 120, zoomed: 110).value) + print(100.screen.width(equalTo: 375, is: 120, zoomed: 110).value) - print("当前屏幕级别: \(UIAdapter.Screen.Level.current)") - print("是否为全面屏: \(UIAdapter.Screen.isFull)") - print("是否为缩放模式: \(UIAdapter.Screen.isZoomedMode)") + print("当前屏幕级别: \(UIAdapter.Screen.main.level)") + print("是否为全面屏: \(UIAdapter.Screen.main.level.isFull)") + print("是否为缩放模式: \(UIAdapter.Screen.main.isZoomedMode)") } override var preferredStatusBarStyle: UIStatusBarStyle { diff --git a/Demo/Podfile b/Demo/Podfile index 8b221d0..c32529e 100644 --- a/Demo/Podfile +++ b/Demo/Podfile @@ -1,4 +1,4 @@ -platform :ios, '10.0' +platform :ios, '15.6' inhibit_all_warnings! target 'Demo' do diff --git a/Demo/Podfile.lock b/Demo/Podfile.lock index 60b0889..d6f5815 100644 --- a/Demo/Podfile.lock +++ b/Demo/Podfile.lock @@ -1,7 +1,7 @@ PODS: - - UIAdapter (1.3.0): - - UIAdapter/Privacy (= 1.3.0) - - UIAdapter/Privacy (1.3.0) + - UIAdapter (1.4.0): + - UIAdapter/Privacy (= 1.4.0) + - UIAdapter/Privacy (1.4.0) DEPENDENCIES: - UIAdapter (from `../`) @@ -11,8 +11,8 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - UIAdapter: 2c0c81c68b308e3ce8b4363d4f66b0ced8c1812f + UIAdapter: 81dd1efbab6c0d092ac0d02e12a3c6b84e3c3c99 -PODFILE CHECKSUM: 0793a3778780a57cf83a43faa9039eedb0b67f7a +PODFILE CHECKSUM: 6c30ea2512eacb7800929df401f020c67f5b94ec COCOAPODS: 1.15.2 diff --git a/Demo/Pods/Local Podspecs/UIAdapter.podspec.json b/Demo/Pods/Local Podspecs/UIAdapter.podspec.json index fd5a15d..e6cb551 100644 --- a/Demo/Pods/Local Podspecs/UIAdapter.podspec.json +++ b/Demo/Pods/Local Podspecs/UIAdapter.podspec.json @@ -1,6 +1,6 @@ { "name": "UIAdapter", - "version": "1.3.0", + "version": "1.4.0", "summary": "iOS屏幕适配工具", "homepage": "https://github.com/lixiang1994/UIAdapter", "license": { @@ -15,19 +15,19 @@ }, "source": { "git": "https://github.com/lixiang1994/UIAdapter.git", - "tag": "1.3.0" + "tag": "1.4.0" }, "source_files": "Sources/**/*.swift", "requires_arc": true, - "swift_versions": "5.3", + "swift_versions": "5.5", "cocoapods_version": ">= 1.4.0", "subspecs": [ { "name": "Privacy", "resource_bundles": { - "Privacy": "Sources/PrivacyInfo.xcprivacy" + "UIAdapter": "Sources/PrivacyInfo.xcprivacy" } } ], - "swift_version": "5.3" + "swift_version": "5.5" } diff --git a/Demo/Pods/Manifest.lock b/Demo/Pods/Manifest.lock index 60b0889..d6f5815 100644 --- a/Demo/Pods/Manifest.lock +++ b/Demo/Pods/Manifest.lock @@ -1,7 +1,7 @@ PODS: - - UIAdapter (1.3.0): - - UIAdapter/Privacy (= 1.3.0) - - UIAdapter/Privacy (1.3.0) + - UIAdapter (1.4.0): + - UIAdapter/Privacy (= 1.4.0) + - UIAdapter/Privacy (1.4.0) DEPENDENCIES: - UIAdapter (from `../`) @@ -11,8 +11,8 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - UIAdapter: 2c0c81c68b308e3ce8b4363d4f66b0ced8c1812f + UIAdapter: 81dd1efbab6c0d092ac0d02e12a3c6b84e3c3c99 -PODFILE CHECKSUM: 0793a3778780a57cf83a43faa9039eedb0b67f7a +PODFILE CHECKSUM: 6c30ea2512eacb7800929df401f020c67f5b94ec COCOAPODS: 1.15.2 diff --git a/Demo/Pods/Pods.xcodeproj/project.pbxproj b/Demo/Pods/Pods.xcodeproj/project.pbxproj index 76cdaa3..64b4c78 100644 --- a/Demo/Pods/Pods.xcodeproj/project.pbxproj +++ b/Demo/Pods/Pods.xcodeproj/project.pbxproj @@ -7,25 +7,25 @@ objects = { /* Begin PBXBuildFile section */ - 0678C4BB52B44C1287CDAF5EABD4CE15 /* UIAdapter-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = BB52F53A36D048C5640D27B3A782E190 /* UIAdapter-dummy.m */; }; + 182744467C38E9E907C9A7EFFB29169D /* UIAdapter.Screen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F41765D79284C40E260ED4D6BDFFDF7 /* UIAdapter.Screen.swift */; }; 19E14B07C75C62FCBA38FEE7411C3E77 /* Pods-Demo-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 3666E01CF3B1BB3B5EB22455C1F1E4F6 /* Pods-Demo-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 31A1BC7882561EED7A6FF1BA3BC739DB /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 37EC504FE85CCB6B7B9276AC69A04880 /* PrivacyInfo.xcprivacy */; }; - 4E12A3AF598797BE008A5380FF0CDC8C /* UIAdapter-Privacy in Resources */ = {isa = PBXBuildFile; fileRef = 3DABA7BAC2939C57E3FFB07A58DBC336 /* UIAdapter-Privacy */; }; + 337A2858AAF21867ACB1D08F7C18F07F /* UIAdapter-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 1BBD0CF16517CDE72429A64E120E050F /* UIAdapter-dummy.m */; }; + 38701D9D0F5A9446697D6BF66A254EE1 /* UIAdapter-UIAdapter in Resources */ = {isa = PBXBuildFile; fileRef = C393B046E6897C8F915736BFC9917744 /* UIAdapter-UIAdapter */; }; 5DDC1F46BC098375EADAC45A953AE9A1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */; }; - 8BB9A4694A87943D92A021B9834073D8 /* UIAdapter.Zoom.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2DD5B3C1EBF1635105F41604DAE1522 /* UIAdapter.Zoom.swift */; }; - 90CCA994AFFE65A948D7173954E3D116 /* UIAdapter-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 069C2FE9A3050BE21350FA0B9A0F9E2E /* UIAdapter-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9827B3096B826CB94B467C3F8836C058 /* UIAdapter.Screen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F41765D79284C40E260ED4D6BDFFDF7 /* UIAdapter.Screen.swift */; }; - D5C4DF5AA86A8B09D9F5BA2056A76DBD /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */; }; + 6D202E79C44E47AFF7D1C4AA508ABAE8 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 37EC504FE85CCB6B7B9276AC69A04880 /* PrivacyInfo.xcprivacy */; }; + AA0AD68F50A05B89C68B68C35CEB17B9 /* UIAdapter-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = C6E02920A69A32E94C077118DAC03AA3 /* UIAdapter-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA0143DA5B5088970E5295266D8D1A86 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */; }; + E94202714CC82FDF75807138703FFEAA /* UIAdapter.Zoom.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2DD5B3C1EBF1635105F41604DAE1522 /* UIAdapter.Zoom.swift */; }; F609DA23894C789CDCB0121BC8BEBA72 /* Pods-Demo-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FC0B6886FC27E9B0BED9829A43F1D61 /* Pods-Demo-dummy.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 3A210B5F78E858A63825056348475F97 /* PBXContainerItemProxy */ = { + 16B30789F879E669172CBBD0072EF0C0 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; - remoteGlobalIDString = AB7CF971874BC255E764940E45F749E8; - remoteInfo = "UIAdapter-Privacy"; + remoteGlobalIDString = EDDE0999C1764791CF0800260AD55218; + remoteInfo = "UIAdapter-UIAdapter"; }; A999FA59A366AEDB3AEFDA1812D38294 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; @@ -37,54 +37,54 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 069C2FE9A3050BE21350FA0B9A0F9E2E /* UIAdapter-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "UIAdapter-umbrella.h"; sourceTree = ""; }; 06F3E5C6ECF6318B927DEBF7D3F68023 /* Pods-Demo-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Demo-acknowledgements.plist"; sourceTree = ""; }; 0FC0B6886FC27E9B0BED9829A43F1D61 /* Pods-Demo-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-Demo-dummy.m"; sourceTree = ""; }; 12B5414F32669A4B7E2A7160C8C61061 /* UIAdapter */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = UIAdapter; path = UIAdapter.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 1BBD0CF16517CDE72429A64E120E050F /* UIAdapter-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "UIAdapter-dummy.m"; sourceTree = ""; }; 286FB7ED904A7A0E1C9B3D6791672A8D /* Pods-Demo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Demo.release.xcconfig"; sourceTree = ""; }; - 32B2AD1E4ED44359AEA4CD4652084A32 /* UIAdapter-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "UIAdapter-prefix.pch"; sourceTree = ""; }; 3666E01CF3B1BB3B5EB22455C1F1E4F6 /* Pods-Demo-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-Demo-umbrella.h"; sourceTree = ""; }; 37EC504FE85CCB6B7B9276AC69A04880 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = Sources/PrivacyInfo.xcprivacy; sourceTree = ""; }; - 3DABA7BAC2939C57E3FFB07A58DBC336 /* UIAdapter-Privacy */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = "UIAdapter-Privacy"; path = Privacy.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; + 3E368EBBBB8D0DEFEFF38A3743A7237A /* UIAdapter.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = UIAdapter.debug.xcconfig; sourceTree = ""; }; 3F41765D79284C40E260ED4D6BDFFDF7 /* UIAdapter.Screen.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = UIAdapter.Screen.swift; sourceTree = ""; }; 5D30FDAD8CECC381F32FF5F5B52175BC /* Pods-Demo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Demo.debug.xcconfig"; sourceTree = ""; }; + 6764C79902817B8D9569F782CE6B98A6 /* UIAdapter-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "UIAdapter-prefix.pch"; sourceTree = ""; }; + 6F385BD1DF401013885E69CDFE731270 /* UIAdapter.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = UIAdapter.modulemap; sourceTree = ""; }; 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 77EBCE1FFE347A3644369F0343168C1D /* Pods-Demo-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Demo-frameworks.sh"; sourceTree = ""; }; 7E65ADC3B1644FF0F90473EEE697A2FF /* Pods-Demo.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-Demo.modulemap"; sourceTree = ""; }; - 8E8D60B84F6A33F062546AA9D9FC66B9 /* UIAdapter-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "UIAdapter-Info.plist"; sourceTree = ""; }; - 8F9E033C4A4BD2A452F8F50527E5E97C /* UIAdapter.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = UIAdapter.modulemap; sourceTree = ""; }; + 9A8F0B0C54577BA1BCF9ED9E2F5FFC1A /* UIAdapter-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "UIAdapter-Info.plist"; sourceTree = ""; }; 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; - 9F356C6637118A3E4CB096E8B4B9D72B /* UIAdapter.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = UIAdapter.debug.xcconfig; sourceTree = ""; }; A2DD5B3C1EBF1635105F41604DAE1522 /* UIAdapter.Zoom.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = UIAdapter.Zoom.swift; sourceTree = ""; }; A5755CA6EB766B0CD852E86612513839 /* UIAdapter.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; path = UIAdapter.podspec; sourceTree = ""; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; - BB52F53A36D048C5640D27B3A782E190 /* UIAdapter-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "UIAdapter-dummy.m"; sourceTree = ""; }; + B00FB3951EDA794D1FA5591F9AE58FC0 /* UIAdapter.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = UIAdapter.release.xcconfig; sourceTree = ""; }; C09550BE27F06DDA0FCBF43F3550A40A /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; path = README.md; sourceTree = ""; }; - C116EB01EA84417510BA249DC5BAE72B /* ResourceBundle-Privacy-UIAdapter-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-Privacy-UIAdapter-Info.plist"; sourceTree = ""; }; + C393B046E6897C8F915736BFC9917744 /* UIAdapter-UIAdapter */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = "UIAdapter-UIAdapter"; path = UIAdapter.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; C694DE63ED5EAB66E3CA6D184271692B /* Pods-Demo */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = "Pods-Demo"; path = Pods_Demo.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + C6E02920A69A32E94C077118DAC03AA3 /* UIAdapter-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "UIAdapter-umbrella.h"; sourceTree = ""; }; C92858FE026ED2D7FA214DF0079DFF16 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; path = LICENSE; sourceTree = ""; }; + DB6E4016C1A5B01B4211686E89C59CA3 /* ResourceBundle-UIAdapter-UIAdapter-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-UIAdapter-UIAdapter-Info.plist"; sourceTree = ""; }; DDEDDEA5E8747667A9BBE52BA22B088D /* Pods-Demo-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Demo-Info.plist"; sourceTree = ""; }; E14C7B5E452F2DDF30E90A3950EE1807 /* Pods-Demo-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-Demo-acknowledgements.markdown"; sourceTree = ""; }; - EA5F570D14E0A0C1E753059BE570B46C /* UIAdapter.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = UIAdapter.release.xcconfig; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 190B01696BE46A0D219F3289375388B1 /* Frameworks */ = { + 3A39F62F9CD07578DE2E282591F36274 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D5C4DF5AA86A8B09D9F5BA2056A76DBD /* Foundation.framework in Frameworks */, + 5DDC1F46BC098375EADAC45A953AE9A1 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 3A39F62F9CD07578DE2E282591F36274 /* Frameworks */ = { + 5CC24496F8AC62B132DF48EDB0ACC1CB /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 5DDC1F46BC098375EADAC45A953AE9A1 /* Foundation.framework in Frameworks */, + DA0143DA5B5088970E5295266D8D1A86 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 7C53188745B1183341FFC642587A74F8 /* Frameworks */ = { + C0E947BAC121797586AF0C642CE6235A /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( @@ -102,16 +102,6 @@ name = "Targets Support Files"; sourceTree = ""; }; - 367495288DE9E6CBF6BE27D073B82120 /* Products */ = { - isa = PBXGroup; - children = ( - C694DE63ED5EAB66E3CA6D184271692B /* Pods-Demo */, - 12B5414F32669A4B7E2A7160C8C61061 /* UIAdapter */, - 3DABA7BAC2939C57E3FFB07A58DBC336 /* UIAdapter-Privacy */, - ); - name = Products; - sourceTree = ""; - }; 578452D2E740E91742655AC8F1636D1F /* iOS */ = { isa = PBXGroup; children = ( @@ -143,13 +133,39 @@ 93063CB6F246C1440C6D652C5B933978 /* Pod */, C3EF43DD9608AC331FB30594FE57226D /* Privacy */, 5B4AD5009FC4176B60D3308421DE4E48 /* Screen */, - E6B71B1E94D43DF0609EC157D695C127 /* Support Files */, + 73D6C3906D9E34DEFEC052A58CFED0A6 /* Support Files */, D515C7D10C0B2E5BEED9AF6ED9CB674D /* Zoom */, ); name = UIAdapter; path = ../..; sourceTree = ""; }; + 73D6C3906D9E34DEFEC052A58CFED0A6 /* Support Files */ = { + isa = PBXGroup; + children = ( + DB6E4016C1A5B01B4211686E89C59CA3 /* ResourceBundle-UIAdapter-UIAdapter-Info.plist */, + 6F385BD1DF401013885E69CDFE731270 /* UIAdapter.modulemap */, + 1BBD0CF16517CDE72429A64E120E050F /* UIAdapter-dummy.m */, + 9A8F0B0C54577BA1BCF9ED9E2F5FFC1A /* UIAdapter-Info.plist */, + 6764C79902817B8D9569F782CE6B98A6 /* UIAdapter-prefix.pch */, + C6E02920A69A32E94C077118DAC03AA3 /* UIAdapter-umbrella.h */, + 3E368EBBBB8D0DEFEFF38A3743A7237A /* UIAdapter.debug.xcconfig */, + B00FB3951EDA794D1FA5591F9AE58FC0 /* UIAdapter.release.xcconfig */, + ); + name = "Support Files"; + path = "Demo/Pods/Target Support Files/UIAdapter"; + sourceTree = ""; + }; + 7D737ADCC6E45E1ED82B9C982AE95F53 /* Products */ = { + isa = PBXGroup; + children = ( + C694DE63ED5EAB66E3CA6D184271692B /* Pods-Demo */, + 12B5414F32669A4B7E2A7160C8C61061 /* UIAdapter */, + C393B046E6897C8F915736BFC9917744 /* UIAdapter-UIAdapter */, + ); + name = Products; + sourceTree = ""; + }; 93063CB6F246C1440C6D652C5B933978 /* Pod */ = { isa = PBXGroup; children = ( @@ -191,7 +207,7 @@ 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */, 65C0D6BBC2BAF760852F2909910722CA /* Development Pods */, D210D550F4EA176C3123ED886F8F87F5 /* Frameworks */, - 367495288DE9E6CBF6BE27D073B82120 /* Products */, + 7D737ADCC6E45E1ED82B9C982AE95F53 /* Products */, 21FF7982FCED7A76D3B9EB72011DACF2 /* Targets Support Files */, ); sourceTree = ""; @@ -213,38 +229,22 @@ path = Sources/Zoom; sourceTree = ""; }; - E6B71B1E94D43DF0609EC157D695C127 /* Support Files */ = { - isa = PBXGroup; - children = ( - C116EB01EA84417510BA249DC5BAE72B /* ResourceBundle-Privacy-UIAdapter-Info.plist */, - 8F9E033C4A4BD2A452F8F50527E5E97C /* UIAdapter.modulemap */, - BB52F53A36D048C5640D27B3A782E190 /* UIAdapter-dummy.m */, - 8E8D60B84F6A33F062546AA9D9FC66B9 /* UIAdapter-Info.plist */, - 32B2AD1E4ED44359AEA4CD4652084A32 /* UIAdapter-prefix.pch */, - 069C2FE9A3050BE21350FA0B9A0F9E2E /* UIAdapter-umbrella.h */, - 9F356C6637118A3E4CB096E8B4B9D72B /* UIAdapter.debug.xcconfig */, - EA5F570D14E0A0C1E753059BE570B46C /* UIAdapter.release.xcconfig */, - ); - name = "Support Files"; - path = "Demo/Pods/Target Support Files/UIAdapter"; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ - 9427D557E407D1BC0B797AF994F42D6E /* Headers */ = { + 42B5D843843EC01EF6ACFB0E666D9154 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 19E14B07C75C62FCBA38FEE7411C3E77 /* Pods-Demo-umbrella.h in Headers */, + AA0AD68F50A05B89C68B68C35CEB17B9 /* UIAdapter-umbrella.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; - A7B228989D1DA619F608A4B2B142CAB0 /* Headers */ = { + 9427D557E407D1BC0B797AF994F42D6E /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 90CCA994AFFE65A948D7173954E3D116 /* UIAdapter-umbrella.h in Headers */, + 19E14B07C75C62FCBA38FEE7411C3E77 /* Pods-Demo-umbrella.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -272,38 +272,38 @@ }; 3DD7B7CA7C05350D22AC11B09F3C5E56 /* UIAdapter */ = { isa = PBXNativeTarget; - buildConfigurationList = 2A84D50085D58C7793FC4851A39EA4E8 /* Build configuration list for PBXNativeTarget "UIAdapter" */; + buildConfigurationList = 14C610886491602A34AA8B805A1B43DC /* Build configuration list for PBXNativeTarget "UIAdapter" */; buildPhases = ( - A7B228989D1DA619F608A4B2B142CAB0 /* Headers */, - DE5ACD48D7AB93AA8E6C94E6907F6659 /* Sources */, - 190B01696BE46A0D219F3289375388B1 /* Frameworks */, - A06A80E459350B6F8441E82C94440AE7 /* Resources */, + 42B5D843843EC01EF6ACFB0E666D9154 /* Headers */, + 6C58F47930A2703018EBCF060C6F7C9A /* Sources */, + 5CC24496F8AC62B132DF48EDB0ACC1CB /* Frameworks */, + 60968CEFBCC25055C68CC73345E82E9B /* Resources */, ); buildRules = ( ); dependencies = ( - C298A8A7D5462BFC79C18756B5E398F2 /* PBXTargetDependency */, + E532E3D1EF2CA2D0EAEFFAB1796A05B0 /* PBXTargetDependency */, ); name = UIAdapter; productName = UIAdapter; productReference = 12B5414F32669A4B7E2A7160C8C61061 /* UIAdapter */; productType = "com.apple.product-type.framework"; }; - AB7CF971874BC255E764940E45F749E8 /* UIAdapter-Privacy */ = { + EDDE0999C1764791CF0800260AD55218 /* UIAdapter-UIAdapter */ = { isa = PBXNativeTarget; - buildConfigurationList = 177248FDE5DC24F4EF40D1BBB652655F /* Build configuration list for PBXNativeTarget "UIAdapter-Privacy" */; + buildConfigurationList = 92A514A7CF93704A34F2F3041C9B6ADA /* Build configuration list for PBXNativeTarget "UIAdapter-UIAdapter" */; buildPhases = ( - F4DE737E574D62FF6106F90DC7B6729C /* Sources */, - 7C53188745B1183341FFC642587A74F8 /* Frameworks */, - 30698802E2387EAA8FFEDF3654CC4765 /* Resources */, + 6C46C77BDF51E07A7A6AFECA96BD674D /* Sources */, + C0E947BAC121797586AF0C642CE6235A /* Frameworks */, + 4E7B05C70F1F7D03850AEEF34601AF17 /* Resources */, ); buildRules = ( ); dependencies = ( ); - name = "UIAdapter-Privacy"; - productName = Privacy; - productReference = 3DABA7BAC2939C57E3FFB07A58DBC336 /* UIAdapter-Privacy */; + name = "UIAdapter-UIAdapter"; + productName = UIAdapter; + productReference = C393B046E6897C8F915736BFC9917744 /* UIAdapter-UIAdapter */; productType = "com.apple.product-type.bundle"; }; /* End PBXNativeTarget section */ @@ -324,13 +324,14 @@ en, ); mainGroup = CF1408CF629C7361332E53B88F7BD30C; - productRefGroup = 367495288DE9E6CBF6BE27D073B82120 /* Products */; + minimizedProjectReferenceProxies = 0; + productRefGroup = 7D737ADCC6E45E1ED82B9C982AE95F53 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 380694B9ADC0CBB5D29A662EFE7F52C8 /* Pods-Demo */, 3DD7B7CA7C05350D22AC11B09F3C5E56 /* UIAdapter */, - AB7CF971874BC255E764940E45F749E8 /* UIAdapter-Privacy */, + EDDE0999C1764791CF0800260AD55218 /* UIAdapter-UIAdapter */, ); }; /* End PBXProject section */ @@ -343,47 +344,47 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 30698802E2387EAA8FFEDF3654CC4765 /* Resources */ = { + 4E7B05C70F1F7D03850AEEF34601AF17 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 31A1BC7882561EED7A6FF1BA3BC739DB /* PrivacyInfo.xcprivacy in Resources */, + 6D202E79C44E47AFF7D1C4AA508ABAE8 /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - A06A80E459350B6F8441E82C94440AE7 /* Resources */ = { + 60968CEFBCC25055C68CC73345E82E9B /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4E12A3AF598797BE008A5380FF0CDC8C /* UIAdapter-Privacy in Resources */, + 38701D9D0F5A9446697D6BF66A254EE1 /* UIAdapter-UIAdapter in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - B6CE35D5169438981428D341B97986EF /* Sources */ = { + 6C46C77BDF51E07A7A6AFECA96BD674D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - F609DA23894C789CDCB0121BC8BEBA72 /* Pods-Demo-dummy.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - DE5ACD48D7AB93AA8E6C94E6907F6659 /* Sources */ = { + 6C58F47930A2703018EBCF060C6F7C9A /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 0678C4BB52B44C1287CDAF5EABD4CE15 /* UIAdapter-dummy.m in Sources */, - 9827B3096B826CB94B467C3F8836C058 /* UIAdapter.Screen.swift in Sources */, - 8BB9A4694A87943D92A021B9834073D8 /* UIAdapter.Zoom.swift in Sources */, + 337A2858AAF21867ACB1D08F7C18F07F /* UIAdapter-dummy.m in Sources */, + 182744467C38E9E907C9A7EFFB29169D /* UIAdapter.Screen.swift in Sources */, + E94202714CC82FDF75807138703FFEAA /* UIAdapter.Zoom.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - F4DE737E574D62FF6106F90DC7B6729C /* Sources */ = { + B6CE35D5169438981428D341B97986EF /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + F609DA23894C789CDCB0121BC8BEBA72 /* Pods-Demo-dummy.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -396,95 +397,18 @@ target = 3DD7B7CA7C05350D22AC11B09F3C5E56 /* UIAdapter */; targetProxy = A999FA59A366AEDB3AEFDA1812D38294 /* PBXContainerItemProxy */; }; - C298A8A7D5462BFC79C18756B5E398F2 /* PBXTargetDependency */ = { + E532E3D1EF2CA2D0EAEFFAB1796A05B0 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - name = "UIAdapter-Privacy"; - target = AB7CF971874BC255E764940E45F749E8 /* UIAdapter-Privacy */; - targetProxy = 3A210B5F78E858A63825056348475F97 /* PBXContainerItemProxy */; + name = "UIAdapter-UIAdapter"; + target = EDDE0999C1764791CF0800260AD55218 /* UIAdapter-UIAdapter */; + targetProxy = 16B30789F879E669172CBBD0072EF0C0 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ - 032ADEBAAF0160CE98812E3673052CB8 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9F356C6637118A3E4CB096E8B4B9D72B /* UIAdapter.debug.xcconfig */; - buildSettings = { - CODE_SIGNING_ALLOWED = NO; - CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/UIAdapter"; - DEVELOPMENT_TEAM = 8G74YECJ4Z; - IBSC_MODULE = UIAdapter; - INFOPLIST_FILE = "Target Support Files/UIAdapter/ResourceBundle-Privacy-UIAdapter-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - PRODUCT_NAME = Privacy; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - WRAPPER_EXTENSION = bundle; - }; - name = Debug; - }; - 1D2CFF2B8D3952A2BE437189AFBBECFF /* Debug */ = { + 01829462C825D2F51DF59BD8DB8ED758 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 5D30FDAD8CECC381F32FF5F5B52175BC /* Pods-Demo.debug.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; - CLANG_ENABLE_OBJC_WEAK = NO; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "Target Support Files/Pods-Demo/Pods-Demo-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-Demo/Pods-Demo.modulemap"; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 2E393A081F44BA9291ACEF3C0A96EC0C /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = EA5F570D14E0A0C1E753059BE570B46C /* UIAdapter.release.xcconfig */; - buildSettings = { - CODE_SIGNING_ALLOWED = NO; - CODE_SIGN_IDENTITY = "Apple Distribution"; - CODE_SIGN_STYLE = Automatic; - CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/UIAdapter"; - DEVELOPMENT_TEAM = 8G74YECJ4Z; - IBSC_MODULE = UIAdapter; - INFOPLIST_FILE = "Target Support Files/UIAdapter/ResourceBundle-Privacy-UIAdapter-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - PRODUCT_NAME = Privacy; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - WRAPPER_EXTENSION = bundle; - }; - name = Release; - }; - 5D3101E8101BD73A09C3DC23F39F3840 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = EA5F570D14E0A0C1E753059BE570B46C /* UIAdapter.release.xcconfig */; + baseConfigurationReference = 3E368EBBBB8D0DEFEFF38A3743A7237A /* UIAdapter.debug.xcconfig */; buildSettings = { "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; @@ -509,15 +433,14 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 5.3; + SWIFT_VERSION = 5.5; TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; - name = Release; + name = Debug; }; - 7EE7A78859F657F6BEFC651185B43192 /* Release */ = { + 44A4B2FB6211B90C1949A44A381F6D1F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; @@ -567,7 +490,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -579,7 +502,44 @@ }; name = Release; }; - 98787F1B2417E31E537C9BDA9318DE81 /* Release */ = { + 78D1B8A770E194D2DC906100D47C348C /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 5D30FDAD8CECC381F32FF5F5B52175BC /* Pods-Demo.debug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "Target Support Files/Pods-Demo/Pods-Demo-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-Demo/Pods-Demo.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 85ACE9A8321DAE0EDB30EC34086D4B8F /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 286FB7ED904A7A0E1C9B3D6791672A8D /* Pods-Demo.release.xcconfig */; buildSettings = { @@ -595,7 +555,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "Target Support Files/Pods-Demo/Pods-Demo-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -617,7 +577,62 @@ }; name = Release; }; - D299434AB35E7FD6F7921C8EF24742FF /* Debug */ = { + 886B5524BF195B309F19EC6019BBE94C /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = B00FB3951EDA794D1FA5591F9AE58FC0 /* UIAdapter.release.xcconfig */; + buildSettings = { + CODE_SIGNING_ALLOWED = NO; + CODE_SIGN_IDENTITY = "Apple Distribution"; + CODE_SIGN_STYLE = Automatic; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/UIAdapter"; + DEVELOPMENT_TEAM = 8G74YECJ4Z; + IBSC_MODULE = UIAdapter; + INFOPLIST_FILE = "Target Support Files/UIAdapter/ResourceBundle-UIAdapter-UIAdapter-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + PRODUCT_NAME = UIAdapter; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = bundle; + }; + name = Release; + }; + 9FE93BEA49F98F59B5883EDD01C68DCA /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = B00FB3951EDA794D1FA5591F9AE58FC0 /* UIAdapter.release.xcconfig */; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/UIAdapter/UIAdapter-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/UIAdapter/UIAdapter-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/UIAdapter/UIAdapter.modulemap"; + PRODUCT_MODULE_NAME = UIAdapter; + PRODUCT_NAME = UIAdapter; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.5; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + A0DC1C2C814704734F83EAB35BB20B21 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; @@ -670,7 +685,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -683,37 +698,23 @@ }; name = Debug; }; - D2ACB7E8F4A9C5A760BB075AE18DE99F /* Debug */ = { + BB0EE533CA798C938695144DF04CF65D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9F356C6637118A3E4CB096E8B4B9D72B /* UIAdapter.debug.xcconfig */; + baseConfigurationReference = 3E368EBBBB8D0DEFEFF38A3743A7237A /* UIAdapter.debug.xcconfig */; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/UIAdapter/UIAdapter-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/UIAdapter/UIAdapter-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + CODE_SIGNING_ALLOWED = NO; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/UIAdapter"; + DEVELOPMENT_TEAM = 8G74YECJ4Z; + IBSC_MODULE = UIAdapter; + INFOPLIST_FILE = "Target Support Files/UIAdapter/ResourceBundle-UIAdapter-UIAdapter-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/UIAdapter/UIAdapter.modulemap"; - PRODUCT_MODULE_NAME = UIAdapter; PRODUCT_NAME = UIAdapter; SDKROOT = iphoneos; SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 5.3; TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; + WRAPPER_EXTENSION = bundle; }; name = Debug; }; @@ -723,35 +724,35 @@ 07B161ABB9C8D622AB1C1AF83FFF968B /* Build configuration list for PBXNativeTarget "Pods-Demo" */ = { isa = XCConfigurationList; buildConfigurations = ( - 1D2CFF2B8D3952A2BE437189AFBBECFF /* Debug */, - 98787F1B2417E31E537C9BDA9318DE81 /* Release */, + 78D1B8A770E194D2DC906100D47C348C /* Debug */, + 85ACE9A8321DAE0EDB30EC34086D4B8F /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 177248FDE5DC24F4EF40D1BBB652655F /* Build configuration list for PBXNativeTarget "UIAdapter-Privacy" */ = { + 14C610886491602A34AA8B805A1B43DC /* Build configuration list for PBXNativeTarget "UIAdapter" */ = { isa = XCConfigurationList; buildConfigurations = ( - 032ADEBAAF0160CE98812E3673052CB8 /* Debug */, - 2E393A081F44BA9291ACEF3C0A96EC0C /* Release */, + 01829462C825D2F51DF59BD8DB8ED758 /* Debug */, + 9FE93BEA49F98F59B5883EDD01C68DCA /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 2A84D50085D58C7793FC4851A39EA4E8 /* Build configuration list for PBXNativeTarget "UIAdapter" */ = { + 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */ = { isa = XCConfigurationList; buildConfigurations = ( - D2ACB7E8F4A9C5A760BB075AE18DE99F /* Debug */, - 5D3101E8101BD73A09C3DC23F39F3840 /* Release */, + A0DC1C2C814704734F83EAB35BB20B21 /* Debug */, + 44A4B2FB6211B90C1949A44A381F6D1F /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */ = { + 92A514A7CF93704A34F2F3041C9B6ADA /* Build configuration list for PBXNativeTarget "UIAdapter-UIAdapter" */ = { isa = XCConfigurationList; buildConfigurations = ( - D299434AB35E7FD6F7921C8EF24742FF /* Debug */, - 7EE7A78859F657F6BEFC651185B43192 /* Release */, + BB0EE533CA798C938695144DF04CF65D /* Debug */, + 886B5524BF195B309F19EC6019BBE94C /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; diff --git a/Demo/Pods/Target Support Files/UIAdapter/ResourceBundle-UIAdapter-UIAdapter-Info.plist b/Demo/Pods/Target Support Files/UIAdapter/ResourceBundle-UIAdapter-UIAdapter-Info.plist new file mode 100644 index 0000000..0677559 --- /dev/null +++ b/Demo/Pods/Target Support Files/UIAdapter/ResourceBundle-UIAdapter-UIAdapter-Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + ${PODS_DEVELOPMENT_LANGUAGE} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.4.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + NSPrincipalClass + + + diff --git a/Demo/Pods/Target Support Files/UIAdapter/UIAdapter-Info.plist b/Demo/Pods/Target Support Files/UIAdapter/UIAdapter-Info.plist index 9bba304..e3a8af0 100644 --- a/Demo/Pods/Target Support Files/UIAdapter/UIAdapter-Info.plist +++ b/Demo/Pods/Target Support Files/UIAdapter/UIAdapter-Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.3.0 + 1.4.0 CFBundleSignature ???? CFBundleVersion diff --git a/README.md b/README.md index e77302d..3c96a7c 100644 --- a/README.md +++ b/README.md @@ -133,24 +133,25 @@ label.numberOfLines = 0.screen.inch(._3_5, is: 1).inch(._4_0, is: 2).value ```swift // default other screen numberOfLines = 0 // width 320 screen numberOfLines = 1 -// width 375 inches screen numberOfLines = 2 -label.numberOfLines = 0.screen.width(._320, is: 1).width(._375, is: 2).value +// width 375 screen numberOfLines = 2 +label.numberOfLines = 0.screen.width(equalTo: 375, is: 1).width(equalTo: 375, is: 2).value ``` ```swift -print("this is " + - "default".screen - .width(._320, is: "width 320") - .width(._375, is: "width 375") - .height(._844, is: "height 844") - .height(._812, is: "height 812") - .inch(._4_7, is: "4.7 inches") - .inch(._5_8, is: "5.8 inches") - .inch(._6_5, is: "6.5 inches") - .level(.compact, is: "screen 3: 2") - .level(.regular, is: "screen 16: 9") - .level(.full, is: "screen 19.5: 9") +print("this is " + "default".screen + .width(equalTo: 375, is: "width equal to 375") + .width(lessThan: 414, is: "width less than 414") + .width(greaterThan: 414, is: "width greater than 414") + .height(equalTo: 700, is: "height equal to 375") + .height(lessThan: 844, is: "height less than 844") + .height(greaterThan: 844, is: "height greater than 844") + .inch(._4_7, is: "4.7-inch") + .inch(._5_8, is: "5.8-inch") + .inch(._6_5, is: "6.5-inch") + .level(.compact, is: "screen (4:3)") + .level(.regular, is: "screen (16:9)") + .level(.full, is: "screen (19.5:9)") .value ) ``` diff --git a/README_CN.md b/README_CN.md index 16ec0f2..f86e259 100644 --- a/README_CN.md +++ b/README_CN.md @@ -130,24 +130,25 @@ label.numberOfLines = 0.screen.inch(._3_5, is: 1).inch(._4_0, is: 2).value ```swift // default other screen numberOfLines = 0 // width 320 screen numberOfLines = 1 -// width 375 inches screen numberOfLines = 2 -label.numberOfLines = 0.screen.width(._320, is: 1).width(._375, is: 2).value +// width 375 screen numberOfLines = 2 +label.numberOfLines = 0.screen.width(equalTo: 320, is: 1).width(equalTo: 375, is: 2).value ``` ```swift -print("this is " + - "default".screen - .width(._320, is: "宽度 320") - .width(._375, is: "宽度 375") - .height(._844, is: "高度 844") - .height(._812, is: "高度 812") +print("this is " + "default".screen + .width(equalTo: 375, is: "宽度 等于 375") + .width(lessThan: 414, is: "宽度 小于 414") + .width(greaterThan: 414, is: "宽度 大于 414") + .height(equalTo: 700, is: "高度 等于 375") + .height(lessThan: 844, is: "高度 小于 844") + .height(greaterThan: 844, is: "高度 大于 844") .inch(._4_7, is: "4.7 英寸") .inch(._5_8, is: "5.8 英寸") .inch(._6_5, is: "6.5 英寸") - .level(.compact, is: "屏幕级别 紧凑屏") - .level(.regular, is: "屏幕级别 常规屏") - .level(.full, is: "屏幕级别 全面屏") + .level(.compact, is: "屏幕级别 紧凑屏 (4:3)") + .level(.regular, is: "屏幕级别 常规屏 (16:9)") + .level(.full, is: "屏幕级别 全面屏 (19.5:9)") .value ) ``` diff --git a/Sources/Screen/UIAdapter.Screen.swift b/Sources/Screen/UIAdapter.Screen.swift index 8982559..91b11ab 100644 --- a/Sources/Screen/UIAdapter.Screen.swift +++ b/Sources/Screen/UIAdapter.Screen.swift @@ -21,19 +21,27 @@ import Foundation import UIKit public class UIAdapterScreenWrapper { - let base: Base + + let base: Screen public private(set) var value: Base - init(_ base: Base) { - self.base = base - self.value = base + init(_ value: Base) { + self.base = .main + self.value = value + } + + init(_ value: Base, _ screen: UIScreen) { + self.base = .init(screen) + self.value = value } } public protocol UIAdapterScreenCompatible { associatedtype ScreenCompatibleType var screen: ScreenCompatibleType { get } + + func screen(_: UIScreen) -> ScreenCompatibleType } extension UIAdapterScreenCompatible { @@ -41,60 +49,118 @@ extension UIAdapterScreenCompatible { public var screen: UIAdapterScreenWrapper { get { return UIAdapterScreenWrapper(self) } } + + public func screen(_ screen: UIScreen) -> UIAdapterScreenWrapper { + return UIAdapterScreenWrapper(self, screen) + } } extension UIAdapterScreenWrapper { public typealias Screen = UIAdapter.Screen - public func width(_ types: Screen.Width..., is value: Base) -> Self { - return width(types, is: value, zoomed: value) + public func width(_ range: Range, is value: Base, zoomed: Base? = nil) -> Self { + return width({ range.contains($0) }, is: value, zoomed: zoomed ?? value) + } + public func width(_ range: ClosedRange, is value: Base, zoomed: Base? = nil) -> Self { + return width({ range.contains($0) }, is: value, zoomed: zoomed ?? value) + } + public func width(_ range: PartialRangeFrom, is value: Base, zoomed: Base? = nil) -> Self { + return width({ range.contains($0) }, is: value, zoomed: zoomed ?? value) + } + public func width(_ range: PartialRangeUpTo, is value: Base, zoomed: Base? = nil) -> Self { + return width({ range.contains($0) }, is: value, zoomed: zoomed ?? value) } - public func width(_ types: Screen.Width..., is value: Base, zoomed: Base) -> Self { - return width(types, is: value, zoomed: zoomed) + public func width(_ range: PartialRangeThrough, is value: Base, zoomed: Base? = nil) -> Self { + return width({ range.contains($0) }, is: value, zoomed: zoomed ?? value) } - private func width(_ types: [Screen.Width], is value: Base, zoomed: Base) -> Self { - for type in types where Screen.Width.current == type { - self.value = Screen.isZoomedMode ? zoomed : value + + public func width(greaterThan base: CGFloat, is value: Base, zoomed: Base? = nil) -> Self { + return width({ $0 > base }, is: value, zoomed: zoomed ?? value) + } + public func width(lessThan base: CGFloat, is value: Base, zoomed: Base? = nil) -> Self { + return width({ $0 < base }, is: value, zoomed: zoomed ?? value) + } + public func width(equalTo base: CGFloat, is value: Base, zoomed: Base? = nil) -> Self { + return width({ $0 == base }, is: value, zoomed: zoomed ?? value) + } + private func width(_ matching: (CGFloat) -> Bool, is value: Base, zoomed: Base) -> Self { + if matching(base.size.width) { + self.value = base.isZoomedMode ? zoomed : value } return self } - public func height(_ types: Screen.Height..., is value: Base) -> Self { - return height(types, is: value, zoomed: value) + public func height(_ range: Range, is value: Base, zoomed: Base? = nil) -> Self { + return height({ range.contains($0) }, is: value, zoomed: zoomed ?? value) + } + public func height(_ range: ClosedRange, is value: Base, zoomed: Base? = nil) -> Self { + return height({ range.contains($0) }, is: value, zoomed: zoomed ?? value) + } + public func height(_ range: PartialRangeFrom, is value: Base, zoomed: Base? = nil) -> Self { + return height({ range.contains($0) }, is: value, zoomed: zoomed ?? value) + } + public func height(_ range: PartialRangeUpTo, is value: Base, zoomed: Base? = nil) -> Self { + return height({ range.contains($0) }, is: value, zoomed: zoomed ?? value) + } + public func height(_ range: PartialRangeThrough, is value: Base, zoomed: Base? = nil) -> Self { + return height({ range.contains($0) }, is: value, zoomed: zoomed ?? value) + } + + public func height(greaterThan base: CGFloat, is value: Base, zoomed: Base? = nil) -> Self { + return height({ $0 > base }, is: value, zoomed: zoomed ?? value) + } + public func height(lessThan base: CGFloat, is value: Base, zoomed: Base? = nil) -> Self { + return height({ $0 < base }, is: value, zoomed: zoomed ?? value) } - public func height(_ types: Screen.Height..., is value: Base, zoomed: Base) -> Self { - return height(types, is: value, zoomed: zoomed) + public func height(equalTo base: CGFloat, is value: Base, zoomed: Base? = nil) -> Self { + return height({ $0 == base }, is: value, zoomed: zoomed ?? value) } - private func height(_ types: [Screen.Height], is value: Base, zoomed: Base) -> Self { - for type in types where Screen.Height.current == type { - self.value = Screen.isZoomedMode ? zoomed : value + private func height(_ matching: (CGFloat) -> Bool, is value: Base, zoomed: Base) -> Self { + if matching(base.size.height) { + self.value = base.isZoomedMode ? zoomed : value } return self } - public func inch(_ types: Screen.Inch..., is value: Base) -> Self { - return inch(types, is: value, zoomed: value) + public func inch(_ range: Range, is value: Base, zoomed: Base? = nil) -> Self { + return inch({ range.contains($0.rawValue) }, is: value, zoomed: zoomed ?? value) + } + public func inch(_ range: ClosedRange, is value: Base, zoomed: Base? = nil) -> Self { + return inch({ range.contains($0.rawValue) }, is: value, zoomed: zoomed ?? value) + } + public func inch(_ range: PartialRangeFrom, is value: Base, zoomed: Base? = nil) -> Self { + return inch({ range.contains($0.rawValue) }, is: value, zoomed: zoomed ?? value) } - public func inch(_ types: Screen.Inch..., is value: Base, zoomed: Base) -> Self { - return inch(types, is: value, zoomed: zoomed) + public func inch(_ range: PartialRangeUpTo, is value: Base, zoomed: Base? = nil) -> Self { + return inch({ range.contains($0.rawValue) }, is: value, zoomed: zoomed ?? value) } - private func inch(_ types: [Screen.Inch], is value: Base, zoomed: Base) -> Self { - for type in types where Screen.Inch.current == type { - self.value = Screen.isZoomedMode ? zoomed : value + public func inch(_ range: PartialRangeThrough, is value: Base, zoomed: Base? = nil) -> Self { + return inch({ range.contains($0.rawValue) }, is: value, zoomed: zoomed ?? value) + } + private func inch(_ matching: (Screen.Inch) -> Bool, is value: Base, zoomed: Base) -> Self { + if matching(base.inch) { + self.value = base.isZoomedMode ? zoomed : value } return self } - public func level(_ types: Screen.Level..., is value: Base) -> Self { - return level(types, is: value, zoomed: value) + public func inch(_ types: Screen.Inch..., is value: Base, zoomed: Base? = nil) -> Self { + return inch(types, is: value, zoomed: zoomed ?? value) } - public func level(_ types: Screen.Level..., is value: Base, zoomed: Base) -> Self { - return level(types, is: value, zoomed: zoomed) + public func inch(_ types: [Screen.Inch], is value: Base, zoomed: Base? = nil) -> Self { + for type in types where base.inch == type { + self.value = base.isZoomedMode ? zoomed ?? value : value + } + return self } - private func level(_ types: [Screen.Level], is value: Base, zoomed: Base) -> Self { - for type in types where Screen.Level.current == type { - self.value = Screen.isZoomedMode ? zoomed : value + + public func level(_ types: Screen.Level..., is value: Base, zoomed: Base? = nil) -> Self { + return level(types, is: value, zoomed: zoomed ?? value) + } + public func level(_ types: [Screen.Level], is value: Base, zoomed: Base? = nil) -> Self { + for type in types where base.level == type { + self.value = base.isZoomedMode ? zoomed ?? value : value } return self } @@ -102,64 +168,73 @@ extension UIAdapterScreenWrapper { extension UIAdapter { - public enum Screen { + public class Screen { + + let base: UIScreen - static var size: CGSize { - UIScreen.main.bounds.size + init(_ base: UIScreen) { + self.base = base } - static var nativeSize: CGSize { - UIScreen.main.nativeBounds.size + + public var size: CGSize { + base.bounds.size } - static var scale: CGFloat { - UIScreen.main.scale + public var nativeSize: CGSize { + base.nativeBounds.size } - static var nativeScale: CGFloat { - UIScreen.main.nativeScale + public var scale: CGFloat { + base.scale + } + public var nativeScale: CGFloat { + base.nativeScale } - } -} - -extension UIAdapter.Screen { - - public static var isZoomedMode: Bool { - guard !isPlus else { return UIScreen.main.bounds.width == 375 } - return UIScreen.main.scale != UIScreen.main.nativeScale - } - - public enum Width: CGFloat { - case unknown = -1 - case _320 = 320 - case _375 = 375 - case _390 = 390 - case _393 = 393 - case _414 = 414 - case _428 = 428 - case _430 = 430 - public static var current: Width { - guard !isPlus else { return ._414 } - return Width(rawValue: nativeSize.width / scale) ?? .unknown + /// 是否为显示缩放模式 + public var isZoomedMode: Bool { + guard !UIDevice.iPhonePlus else { return size.width == 375 } + guard !UIDevice.iPhoneMini else { return size.width == 320 } + return scale != nativeScale } - } - - public enum Height: CGFloat { - case unknown = -1 - case _480 = 480 - case _568 = 568 - case _667 = 667 - case _736 = 736 - case _812 = 812 - case _844 = 844 - case _852 = 852 - case _896 = 896 - case _926 = 926 - case _932 = 932 - public static var current: Height { - guard !isPlus else { return ._736 } - return Height(rawValue: nativeSize.height / scale) ?? .unknown + /// 真实宽高比 例如: iPhone 16 Pro (201:437) + public var aspectRatio: String { + if + let cache = _aspectRatio, + cache.0 == nativeSize { + return cache.1 + + } else { + let result = base.aspectRatio + _aspectRatio = (nativeSize, result) + return result + } } + private var _aspectRatio: (CGSize, String)? + + /// 标准宽高比 例如: iPhone 16 Pro (9:19.5) + public var standardAspectRatio: String { + if + let cache = _standardAspectRatio, + cache.0 == nativeSize { + return cache.1 + + } else { + let result = base.standardAspectRatio + _standardAspectRatio = (nativeSize, result) + return result + } + } + private var _standardAspectRatio: (CGSize, String)? } +} + +extension UIAdapter.Screen { + + /// 当前主屏幕 + public static let main = UIAdapter.Screen(.main) +} + +extension UIAdapter.Screen { public enum Inch: Double { case unknown = -1 @@ -170,46 +245,49 @@ extension UIAdapter.Screen { case _5_5 = 5.5 case _5_8 = 5.8 case _6_1 = 6.1 + case _6_3 = 6.3 case _6_5 = 6.5 case _6_7 = 6.7 + case _6_9 = 6.9 + } + + public var inch: Inch { + switch (nativeSize.width / scale, nativeSize.height / scale, scale) { + case (320, 480, 2): + return ._3_5 + + case (320, 568, 2): + return ._4_0 + + case (375, 667, 2): + return ._4_7 + + case (360, 780, 3) where UIDevice.iPhoneMini, (375, 812, 3) where UIDevice.iPhoneMini: + return ._5_4 + + case (360, 640, 3) where UIDevice.iPhonePlus, (414, 736, 3) where UIDevice.iPhonePlus: + return ._5_5 - public static var current: Inch { - guard !isPlus else { - // Plus 机型比较特殊 下面公式无法正确计算出尺寸 - return ._5_5 - } + case (375, 812, 3): + return ._5_8 - switch (nativeSize.width / scale, nativeSize.height / scale, scale) { - case (320, 480, 2): - return ._3_5 - - case (320, 568, 2): - return ._4_0 - - case (375, 667, 2): - return ._4_7 - - case (375, 812, 3) where UIDevice.iPhoneMini: - return ._5_4 - - case (414, 736, 3): - return ._5_5 + case (414, 896, 2), (390, 844, 3), (393, 852, 3): + return ._6_1 - case (375, 812, 3): - return ._5_8 - - case (414, 896, 2), (390, 844, 3), (393, 852, 3): - return ._6_1 + case (402, 874, 3): + return ._6_3 - case (414, 896, 3): - return ._6_5 - - case (428, 926, 3), (430, 932, 3): - return ._6_7 - - default: - return .unknown - } + case (414, 896, 3): + return ._6_5 + + case (428, 926, 3), (430, 932, 3): + return ._6_7 + + case (440, 956, 3): + return ._6_9 + + default: + return .unknown } } @@ -222,45 +300,33 @@ extension UIAdapter.Screen { /// 19.5: 9 case full - public static var current: Level { - guard !isPlus else { - // Plus 机型比较特殊 下面公式无法正确计算出尺寸 - return .regular - } - - switch (nativeSize.width / scale, nativeSize.height / scale) { - case (320, 480): - return .compact - - case (320, 568), (375, 667), (414, 736): - return .regular - - case (375, 812), (414, 896), (390, 844), (393, 852), (428, 926), (430, 932): - return .full - - default: - return .unknown - } + public var isCompact: Bool { + self == .compact + } + + public var isRegular: Bool { + self == .regular + } + + public var isFull: Bool { + self == .full } } - private static var isPlus: Bool { - return nativeSize.equalTo(.init(width: 1080, height: 1920)) - } -} - -extension UIAdapter.Screen { - - public static var isCompact: Bool { - return Level.current == .compact - } - - public static var isRegular: Bool { - return Level.current == .regular - } - - public static var isFull: Bool { - return Level.current == .full + public var level: Level { + switch standardAspectRatio { + case "3:4", "4:3": + return .compact + + case "9:16", "16:9": + return .regular + + case "9:19.5", "19.5:9": + return .full + + default: + return .unknown + } } } @@ -281,15 +347,48 @@ extension UIEdgeInsets: UIAdapterScreenCompatible {} fileprivate extension UIDevice { + /// 是否使用了降采样 + static var isUsingDownsampling: Bool { + return iPhoneMini || iPhonePlus + } + static var iPhoneMini: Bool { + let temp = ["iPhone13,1", "iPhone14,4"] + switch identifier { case "iPhone13,1", "iPhone14,4": return true case "i386", "x86_64", "arm64": - return ["iPhone13,1", "iPhone14,4"].contains( - ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"] ?? "" - ) + return temp.contains(ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"] ?? "") + + default: + return false + } + } + + static var iPhonePlus: Bool { + let temp = [ + "iPhone7,1", + "iPhone8,2", + "iPhone9,2", + "iPhone9,4", + "iPhone10,2", + "iPhone10,5" + ] + + switch identifier { + case + "iPhone7,1", + "iPhone8,2", + "iPhone9,2", + "iPhone9,4", + "iPhone10,2", + "iPhone10,5": + return true + + case "i386", "x86_64", "arm64": + return temp.contains(ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"] ?? "") default: return false @@ -309,4 +408,81 @@ fileprivate extension UIDevice { } () } +extension UIScreen { + + /// 真实宽高比 例如: iPhone 16 Pro (201:437) + var aspectRatio: String { + // 计算宽高比 + let (ratioWidth, ratioHeight) = calculateAspectRatio( + width: nativeBounds.width, + height: nativeBounds.height + ) + return "\(ratioWidth):\(ratioHeight)" + } + + /// 标准宽高比 例如: iPhone 16 Pro (9:19.5) + var standardAspectRatio: String { + // 获取近似的标准比例 + return getStandardAspectRatio( + width: nativeBounds.width, + height: nativeBounds.height + ) + } + + private func calculateAspectRatio(width: CGFloat, height: CGFloat) -> (Int, Int) { + // 计算最大公约数(欧几里得算法) + func gcd(_ a: Int, _ b: Int) -> Int { + var a = a + var b = b + while b != 0 { + let temp = b + b = a % b + a = temp + } + return a + } + + let precision: CGFloat = 1000 // 精度倍数 + let widthInt = Int(width * precision) + let heightInt = Int(height * precision) + + let gcdValue = gcd(widthInt, heightInt) + + let ratioWidth = widthInt / gcdValue + let ratioHeight = heightInt / gcdValue + + return (ratioWidth, ratioHeight) + } + + private func getStandardAspectRatio(width: CGFloat, height: CGFloat) -> String { + let aspectRatio = width / height + + // 常见的屏幕比例 + let commonRatios: [(ratio: CGFloat, description: String)] = [ + (16.0/9.0, "16:9"), + (9.0/16.0, "9:16"), + (4.0/3.0, "4:3"), + (3.0/4.0, "3:4"), + (19.5/9.0, "19.5:9"), + (9.0/19.5, "9:19.5"), + (2.0/1.0, "2:1"), + (1.0/2.0, "1:2"), + (1.0/1.0, "1:1") + ] + + var closestRatio = commonRatios[0] + var smallestDifference = abs(aspectRatio - closestRatio.ratio) + + for ratio in commonRatios { + let difference = abs(aspectRatio - ratio.ratio) + if difference < smallestDifference { + smallestDifference = difference + closestRatio = ratio + } + } + + return closestRatio.description + } +} + #endif diff --git a/UIAdapter.podspec b/UIAdapter.podspec index c3e2ddf..c8d2f83 100644 --- a/UIAdapter.podspec +++ b/UIAdapter.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "UIAdapter" -s.version = "1.3.1" +s.version = "1.4.0" s.summary = "iOS屏幕适配工具" s.homepage = "https://github.com/lixiang1994/UIAdapter" @@ -18,7 +18,7 @@ s.source_files = "Sources/**/*.swift" s.requires_arc = true -s.swift_version = '5.3' +s.swift_version = '5.5' s.cocoapods_version = '>= 1.4.0'