diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ddb0340..cfe0d21 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -17,9 +17,9 @@ jobs:
strategy:
matrix:
destination:
- - platform=iOS Simulator,name=iPhone 16,OS=18.0
- - platform=watchOS Simulator,name=Apple Watch SE (40mm) (2nd generation),OS=11.0
- - platform=tvOS Simulator,name=Apple TV 4K (3rd generation) (at 1080p),OS=18.0
+ - platform=iOS Simulator,name=iPhone 16,OS=18.1
+ - platform=watchOS Simulator,name=Apple Watch SE (40mm) (2nd generation),OS=11.1
+ - platform=tvOS Simulator,name=Apple TV 4K (3rd generation) (at 1080p),OS=18.1
- platform=macOS,arch=arm64
with:
package: OversizeUI
@@ -33,8 +33,8 @@ jobs:
strategy:
matrix:
destination:
- - platform=iOS Simulator,name=iPhone 16 Pro,OS=18.0
- - platform=iOS Simulator,name=iPad (10th generation),OS=18.0
+ - platform=iOS Simulator,name=iPhone 16 Pro,OS=18.1
+ - platform=iOS Simulator,name=iPad (10th generation),OS=18.1
with:
path: Example/Example
scheme: Example (iOS)
@@ -58,8 +58,8 @@ jobs:
strategy:
matrix:
destination:
- - platform=tvOS Simulator,name=Apple TV 4K (3rd generation) (at 1080p),OS=18.0
- - platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=18.0
+ - platform=tvOS Simulator,name=Apple TV 4K (3rd generation) (at 1080p),OS=18.1
+ - platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=18.1
with:
path: Example/Example
scheme: Example (tvOS)
@@ -73,7 +73,7 @@ jobs:
strategy:
matrix:
destination:
- - platform=watchOS Simulator,name=Apple Watch SE (40mm) (2nd generation),OS=11.0
+ - platform=watchOS Simulator,name=Apple Watch SE (40mm) (2nd generation),OS=11.1
with:
path: Example/Example
scheme: Example (watchOS)
diff --git a/Example/Example WatchKit App/Info.plist b/Example/Example WatchKit App/Info.plist
index 32e1d08..03a76ab 100644
--- a/Example/Example WatchKit App/Info.plist
+++ b/Example/Example WatchKit App/Info.plist
@@ -20,12 +20,16 @@
1.0
CFBundleVersion
1
+ CLKComplicationPrincipalClass
+ $(PRODUCT_MODULE_NAME).ComplicationController
UISupportedInterfaceOrientations
UIInterfaceOrientationPortrait
UIInterfaceOrientationPortraitUpsideDown
- WKWatchKitApp
+ WKApplication
+
+ WKWatchOnly
diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj
index d445862..bb6f3ce 100644
--- a/Example/Example.xcodeproj/project.pbxproj
+++ b/Example/Example.xcodeproj/project.pbxproj
@@ -9,7 +9,6 @@
/* Begin PBXBuildFile section */
1101694E26E41DE10035CB67 /* Example (watchOS).app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = 1101694D26E41DE10035CB67 /* Example (watchOS).app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
1101695326E41DE30035CB67 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1101695226E41DE30035CB67 /* Assets.xcassets */; };
- 1101695A26E41DE40035CB67 /* Example WatchKit Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 1101695926E41DE40035CB67 /* Example WatchKit Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
1101696326E41DE40035CB67 /* NotificationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1101696226E41DE40035CB67 /* NotificationController.swift */; };
1101696526E41DE40035CB67 /* NotificationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1101696426E41DE40035CB67 /* NotificationView.swift */; };
1101696726E41DE40035CB67 /* ComplicationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1101696626E41DE40035CB67 /* ComplicationController.swift */; };
@@ -91,26 +90,19 @@
remoteGlobalIDString = 1101694C26E41DE10035CB67;
remoteInfo = "Example WatchKit App";
};
- 1101695B26E41DE40035CB67 /* PBXContainerItemProxy */ = {
+ 1101697F26E41DE50035CB67 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 84D9F9DC26BDE4EA00B2FCA2 /* Project object */;
proxyType = 1;
- remoteGlobalIDString = 1101695826E41DE40035CB67;
- remoteInfo = "Example WatchKit Extension";
+ remoteGlobalIDString = 1101694C26E41DE10035CB67;
+ remoteInfo = "Example WatchKit App";
};
- 1101697426E41DE50035CB67 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 84D9F9DC26BDE4EA00B2FCA2 /* Project object */;
- proxyType = 1;
- remoteGlobalIDString = 1101695826E41DE40035CB67;
- remoteInfo = "Example WatchKit Extension";
- };
- 1101697F26E41DE50035CB67 /* PBXContainerItemProxy */ = {
+ 848111842CDFFFDE004D65FE /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 84D9F9DC26BDE4EA00B2FCA2 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 1101694C26E41DE10035CB67;
- remoteInfo = "Example WatchKit App";
+ remoteInfo = "Example (watchOS)";
};
/* End PBXContainerItemProxy section */
@@ -126,17 +118,6 @@
name = "Embed Watch Content";
runOnlyForDeploymentPostprocessing = 0;
};
- 1101698A26E41DE50035CB67 /* Embed App Extensions */ = {
- isa = PBXCopyFilesBuildPhase;
- buildActionMask = 2147483647;
- dstPath = "";
- dstSubfolderSpec = 13;
- files = (
- 1101695A26E41DE40035CB67 /* Example WatchKit Extension.appex in Embed App Extensions */,
- );
- name = "Embed App Extensions";
- runOnlyForDeploymentPostprocessing = 0;
- };
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
@@ -144,7 +125,6 @@
1101694D26E41DE10035CB67 /* Example (watchOS).app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Example (watchOS).app"; sourceTree = BUILT_PRODUCTS_DIR; };
1101695226E41DE30035CB67 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
1101695426E41DE30035CB67 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
- 1101695926E41DE40035CB67 /* Example WatchKit Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Example WatchKit Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
1101696226E41DE40035CB67 /* NotificationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationController.swift; sourceTree = ""; };
1101696426E41DE40035CB67 /* NotificationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationView.swift; sourceTree = ""; };
1101696626E41DE40035CB67 /* ComplicationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComplicationController.swift; sourceTree = ""; };
@@ -369,7 +349,6 @@
84D9F9F026BDE4EB00B2FCA2 /* Example.app */,
1101694A26E41DE10035CB67 /* Example.app */,
1101694D26E41DE10035CB67 /* Example (watchOS).app */,
- 1101695926E41DE40035CB67 /* Example WatchKit Extension.appex */,
1101697326E41DE40035CB67 /* ExampleTests.xctest */,
1101697E26E41DE50035CB67 /* ExampleUITests.xctest */,
1101699E26E423260035CB67 /* Example (tvOS).app */,
@@ -419,37 +398,17 @@
buildConfigurationList = 1101699226E41DE50035CB67 /* Build configuration list for PBXNativeTarget "Example (watchOS)" */;
buildPhases = (
1101694B26E41DE10035CB67 /* Resources */,
- 1101698A26E41DE50035CB67 /* Embed App Extensions */,
+ 1101695526E41DE40035CB67 /* Sources */,
+ 1101695626E41DE40035CB67 /* Frameworks */,
);
buildRules = (
);
dependencies = (
- 1101695C26E41DE40035CB67 /* PBXTargetDependency */,
);
name = "Example (watchOS)";
productName = "Example WatchKit App";
productReference = 1101694D26E41DE10035CB67 /* Example (watchOS).app */;
- productType = "com.apple.product-type.application.watchapp2";
- };
- 1101695826E41DE40035CB67 /* Example WatchKit Extension */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = 1101699126E41DE50035CB67 /* Build configuration list for PBXNativeTarget "Example WatchKit Extension" */;
- buildPhases = (
- 1101695526E41DE40035CB67 /* Sources */,
- 1101695626E41DE40035CB67 /* Frameworks */,
- 1101695726E41DE40035CB67 /* Resources */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = "Example WatchKit Extension";
- packageProductDependencies = (
- 114C9CCA26ECC74A00520E04 /* OversizeUI */,
- );
- productName = "Example WatchKit Extension";
- productReference = 1101695926E41DE40035CB67 /* Example WatchKit Extension.appex */;
- productType = "com.apple.product-type.watchkit2-extension";
+ productType = "com.apple.product-type.application";
};
1101697226E41DE40035CB67 /* ExampleTests */ = {
isa = PBXNativeTarget;
@@ -462,7 +421,7 @@
buildRules = (
);
dependencies = (
- 1101697526E41DE50035CB67 /* PBXTargetDependency */,
+ 848111852CDFFFDE004D65FE /* PBXTargetDependency */,
);
name = ExampleTests;
productName = ExampleTests;
@@ -553,8 +512,9 @@
84D9F9DC26BDE4EA00B2FCA2 /* Project object */ = {
isa = PBXProject;
attributes = {
+ BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 1250;
- LastUpgradeCheck = 1330;
+ LastUpgradeCheck = 1610;
TargetAttributes = {
1101694926E41DE10035CB67 = {
CreatedOnToolsVersion = 12.5.1;
@@ -563,12 +523,9 @@
CreatedOnToolsVersion = 12.5.1;
LastSwiftMigration = 1250;
};
- 1101695826E41DE40035CB67 = {
- CreatedOnToolsVersion = 12.5.1;
- };
1101697226E41DE40035CB67 = {
CreatedOnToolsVersion = 12.5.1;
- TestTargetID = 1101695826E41DE40035CB67;
+ TestTargetID = 1101694C26E41DE10035CB67;
};
1101697D26E41DE50035CB67 = {
CreatedOnToolsVersion = 12.5.1;
@@ -602,7 +559,6 @@
84D9F9EF26BDE4EB00B2FCA2 /* Example (macOS) */,
1101694926E41DE10035CB67 /* Example */,
1101694C26E41DE10035CB67 /* Example (watchOS) */,
- 1101695826E41DE40035CB67 /* Example WatchKit Extension */,
1101697226E41DE40035CB67 /* ExampleTests */,
1101697D26E41DE50035CB67 /* ExampleUITests */,
1101699D26E423260035CB67 /* Example (tvOS) */,
@@ -619,19 +575,12 @@
runOnlyForDeploymentPostprocessing = 0;
};
1101694B26E41DE10035CB67 /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 1101695326E41DE30035CB67 /* Assets.xcassets in Resources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- 1101695726E41DE40035CB67 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1101696C26E41DE40035CB67 /* Preview Assets.xcassets in Resources */,
1101696926E41DE40035CB67 /* Assets.xcassets in Resources */,
+ 1101695326E41DE30035CB67 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -788,21 +737,16 @@
target = 1101694C26E41DE10035CB67 /* Example (watchOS) */;
targetProxy = 1101694F26E41DE10035CB67 /* PBXContainerItemProxy */;
};
- 1101695C26E41DE40035CB67 /* PBXTargetDependency */ = {
- isa = PBXTargetDependency;
- target = 1101695826E41DE40035CB67 /* Example WatchKit Extension */;
- targetProxy = 1101695B26E41DE40035CB67 /* PBXContainerItemProxy */;
- };
- 1101697526E41DE50035CB67 /* PBXTargetDependency */ = {
- isa = PBXTargetDependency;
- target = 1101695826E41DE40035CB67 /* Example WatchKit Extension */;
- targetProxy = 1101697426E41DE50035CB67 /* PBXContainerItemProxy */;
- };
1101698026E41DE50035CB67 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 1101694C26E41DE10035CB67 /* Example (watchOS) */;
targetProxy = 1101697F26E41DE50035CB67 /* PBXContainerItemProxy */;
};
+ 848111852CDFFFDE004D65FE /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 1101694C26E41DE10035CB67 /* Example (watchOS) */;
+ targetProxy = 848111842CDFFFDE004D65FE /* PBXContainerItemProxy */;
+ };
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
@@ -817,7 +761,7 @@
PRODUCT_BUNDLE_IDENTIFIER = romanov.cc.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
- SWIFT_VERSION = 5.0;
+ SWIFT_VERSION = 6.0;
};
name = Debug;
};
@@ -832,7 +776,7 @@
PRODUCT_BUNDLE_IDENTIFIER = romanov.cc.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
- SWIFT_VERSION = 5.0;
+ SWIFT_VERSION = 6.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
@@ -840,25 +784,23 @@
1101698826E41DE50035CB67 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = ER582ZK85C;
- IBSC_MODULE = Example_WatchKit_Extension;
INFOPLIST_FILE = "Example WatchKit App/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
- "$(inherited)",
- "@executable_path/../Frameworks",
- "@loader_path/../Frameworks",
+ "@executable_path/Frameworks",
+ "@executable_path/../../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = romanov.cc.Example.watchkitapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
- SWIFT_VERSION = 5.0;
+ SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 9.0;
};
@@ -867,73 +809,22 @@
1101698926E41DE50035CB67 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = ER582ZK85C;
- IBSC_MODULE = Example_WatchKit_Extension;
INFOPLIST_FILE = "Example WatchKit App/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
- "$(inherited)",
- "@executable_path/../Frameworks",
- "@loader_path/../Frameworks",
- );
- PRODUCT_BUNDLE_IDENTIFIER = romanov.cc.Example.watchkitapp;
- PRODUCT_NAME = "$(TARGET_NAME)";
- SDKROOT = watchos;
- SKIP_INSTALL = YES;
- SWIFT_VERSION = 5.0;
- TARGETED_DEVICE_FAMILY = 4;
- VALIDATE_PRODUCT = YES;
- WATCHOS_DEPLOYMENT_TARGET = 9.0;
- };
- name = Release;
- };
- 1101698B26E41DE50035CB67 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication;
- CODE_SIGN_STYLE = Automatic;
- DEVELOPMENT_ASSET_PATHS = "\"Example WatchKit Extension/Preview Content\"";
- DEVELOPMENT_TEAM = ER582ZK85C;
- ENABLE_PREVIEWS = YES;
- INFOPLIST_FILE = "Example WatchKit Extension/Info.plist";
- LD_RUNPATH_SEARCH_PATHS = (
- "$(inherited)",
- "@executable_path/Frameworks",
- "@executable_path/../../Frameworks",
- );
- PRODUCT_BUNDLE_IDENTIFIER = romanov.cc.Example.watchkitapp.watchkitextension;
- PRODUCT_NAME = "${TARGET_NAME}";
- SDKROOT = watchos;
- SKIP_INSTALL = YES;
- SWIFT_VERSION = 5.0;
- TARGETED_DEVICE_FAMILY = 4;
- WATCHOS_DEPLOYMENT_TARGET = 9.0;
- };
- name = Debug;
- };
- 1101698C26E41DE50035CB67 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication;
- CODE_SIGN_STYLE = Automatic;
- DEVELOPMENT_ASSET_PATHS = "\"Example WatchKit Extension/Preview Content\"";
- DEVELOPMENT_TEAM = ER582ZK85C;
- ENABLE_PREVIEWS = YES;
- INFOPLIST_FILE = "Example WatchKit Extension/Info.plist";
- LD_RUNPATH_SEARCH_PATHS = (
- "$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
- PRODUCT_BUNDLE_IDENTIFIER = romanov.cc.Example.watchkitapp.watchkitextension;
- PRODUCT_NAME = "${TARGET_NAME}";
+ PRODUCT_BUNDLE_IDENTIFIER = romanov.cc.Example.watchkitapp;
+ PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = watchos;
SKIP_INSTALL = YES;
- SWIFT_VERSION = 5.0;
+ SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = 4;
VALIDATE_PRODUCT = YES;
WATCHOS_DEPLOYMENT_TARGET = 9.0;
@@ -943,7 +834,6 @@
1101698D26E41DE50035CB67 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = ER582ZK85C;
@@ -956,9 +846,9 @@
PRODUCT_BUNDLE_IDENTIFIER = romanov.cc.ExampleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = watchos;
- SWIFT_VERSION = 5.0;
+ SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = 4;
- TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example WatchKit Extension.appex/Example WatchKit Extension";
+ TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example (watchOS).app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Example (watchOS)";
WATCHOS_DEPLOYMENT_TARGET = 9.0;
};
name = Debug;
@@ -966,7 +856,6 @@
1101698E26E41DE50035CB67 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = ER582ZK85C;
@@ -979,9 +868,9 @@
PRODUCT_BUNDLE_IDENTIFIER = romanov.cc.ExampleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = watchos;
- SWIFT_VERSION = 5.0;
+ SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = 4;
- TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example WatchKit Extension.appex/Example WatchKit Extension";
+ TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example (watchOS).app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Example (watchOS)";
VALIDATE_PRODUCT = YES;
WATCHOS_DEPLOYMENT_TARGET = 9.0;
};
@@ -1001,7 +890,7 @@
PRODUCT_BUNDLE_IDENTIFIER = romanov.cc.ExampleUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = watchos;
- SWIFT_VERSION = 5.0;
+ SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = 4;
TEST_TARGET_NAME = "Example WatchKit App";
WATCHOS_DEPLOYMENT_TARGET = 9.0;
@@ -1022,7 +911,7 @@
PRODUCT_BUNDLE_IDENTIFIER = romanov.cc.ExampleUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = watchos;
- SWIFT_VERSION = 5.0;
+ SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = 4;
TEST_TARGET_NAME = "Example WatchKit App";
VALIDATE_PRODUCT = YES;
@@ -1045,7 +934,7 @@
PRODUCT_BUNDLE_IDENTIFIER = romanov.cc.ExampletvOS;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
- SWIFT_VERSION = 5.0;
+ SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 15.0;
};
@@ -1066,7 +955,7 @@
PRODUCT_BUNDLE_IDENTIFIER = romanov.cc.ExampletvOS;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
- SWIFT_VERSION = 5.0;
+ SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 15.0;
VALIDATE_PRODUCT = YES;
@@ -1077,6 +966,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
@@ -1107,9 +997,11 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
+ DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
+ ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
@@ -1136,6 +1028,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
@@ -1166,9 +1059,11 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
+ DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@@ -1201,7 +1096,7 @@
PRODUCT_BUNDLE_IDENTIFIER = romanov.cc.Example;
PRODUCT_NAME = Example;
SDKROOT = iphoneos;
- SWIFT_VERSION = 5.0;
+ SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@@ -1223,7 +1118,7 @@
PRODUCT_BUNDLE_IDENTIFIER = romanov.cc.Example;
PRODUCT_NAME = Example;
SDKROOT = iphoneos;
- SWIFT_VERSION = 5.0;
+ SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
@@ -1238,6 +1133,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
+ DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = ER582ZK85C;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
@@ -1246,11 +1142,11 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
- MACOSX_DEPLOYMENT_TARGET = 13.0;
+ MACOSX_DEPLOYMENT_TARGET = 14.0;
PRODUCT_BUNDLE_IDENTIFIER = romanov.cc.Example;
PRODUCT_NAME = Example;
SDKROOT = macosx;
- SWIFT_VERSION = 5.0;
+ SWIFT_VERSION = 6.0;
};
name = Debug;
};
@@ -1263,6 +1159,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
+ DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = ER582ZK85C;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
@@ -1271,26 +1168,17 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
- MACOSX_DEPLOYMENT_TARGET = 13.0;
+ MACOSX_DEPLOYMENT_TARGET = 14.0;
PRODUCT_BUNDLE_IDENTIFIER = romanov.cc.Example;
PRODUCT_NAME = Example;
SDKROOT = macosx;
- SWIFT_VERSION = 5.0;
+ SWIFT_VERSION = 6.0;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
- 1101699126E41DE50035CB67 /* Build configuration list for PBXNativeTarget "Example WatchKit Extension" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 1101698B26E41DE50035CB67 /* Debug */,
- 1101698C26E41DE50035CB67 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
1101699226E41DE50035CB67 /* Build configuration list for PBXNativeTarget "Example (watchOS)" */ = {
isa = XCConfigurationList;
buildConfigurations = (
diff --git a/Example/Example.xcodeproj/xcshareddata/xcschemes/Example (iOS).xcscheme b/Example/Example.xcodeproj/xcshareddata/xcschemes/Example (iOS).xcscheme
index 4a05217..28cd8ba 100644
--- a/Example/Example.xcodeproj/xcshareddata/xcschemes/Example (iOS).xcscheme
+++ b/Example/Example.xcodeproj/xcshareddata/xcschemes/Example (iOS).xcscheme
@@ -1,6 +1,6 @@
Avatar {
+ func avatarStroke(_ strokeColor: Color = .surfacePrimary, lineWidth: CGFloat = 2) -> Avatar {
var control = self
control.strokeColor = strokeColor
+ control.strokeLineWidth = lineWidth
return control
}
}
diff --git a/Sources/OversizeUI/Controls/Avatar/AvatarPreview.swift b/Sources/OversizeUI/Controls/Avatar/AvatarPreview.swift
index 64dfe59..1f30835 100644
--- a/Sources/OversizeUI/Controls/Avatar/AvatarPreview.swift
+++ b/Sources/OversizeUI/Controls/Avatar/AvatarPreview.swift
@@ -1,6 +1,6 @@
//
// Copyright © 2023 Aleksandr Romanov
-// File.swift, created on 10.03.2023
+// AvatarPreview.swift, created on 10.03.2023
//
import SwiftUI
diff --git a/Sources/OversizeUI/Controls/Button/BarButton.swift b/Sources/OversizeUI/Controls/Button/BarButton.swift
index 488a089..542974d 100644
--- a/Sources/OversizeUI/Controls/Button/BarButton.swift
+++ b/Sources/OversizeUI/Controls/Button/BarButton.swift
@@ -133,17 +133,17 @@ public struct BarButton: View {
case let .primary(text, _):
Text(text)
case .closeAction:
- IconDeprecated(.xMini, color: .onSurfaceMediumEmphasis)
+ IconDeprecated(.xMini, color: .onSurfaceSecondary)
case .backAction:
- IconDeprecated(.arrowLeft, color: .onSurfaceMediumEmphasis)
+ IconDeprecated(.arrowLeft, color: .onSurfaceSecondary)
case let .disabled(text):
Text(text)
case let .image(image, _):
image
.renderingMode(.template)
- .onSurfaceHighEmphasisForegroundColor()
+ .onSurfacePrimaryForeground()
case let .icon(icon, _):
- IconDeprecated(icon, color: .onSurfaceMediumEmphasis)
+ IconDeprecated(icon, color: .onSurfaceSecondary)
}
}
}
diff --git a/Sources/OversizeUI/Controls/Button/Button.swift b/Sources/OversizeUI/Controls/Button/Button.swift
index a8c64f6..0e4a645 100644
--- a/Sources/OversizeUI/Controls/Button/Button.swift
+++ b/Sources/OversizeUI/Controls/Button/Button.swift
@@ -56,7 +56,7 @@ public struct OversizeButtonStyle: ButtonStyle {
.opacity(backgroundOpacity))
.overlay {
Capsule()
- .strokeBorder(Color.onSurfaceHighEmphasis.opacity(0.15), lineWidth: 2)
+ .strokeBorder(Color.onSurfacePrimary.opacity(0.15), lineWidth: 2)
.opacity(isBordered || theme.borderButtons ? 1 : 0)
}
@@ -66,7 +66,7 @@ public struct OversizeButtonStyle: ButtonStyle {
.opacity(backgroundOpacity))
.overlay {
RoundedRectangle(cornerRadius: radius != .medium ? radius.rawValue : theme.radius, style: .continuous)
- .strokeBorder(Color.onSurfaceHighEmphasis.opacity(0.15), lineWidth: 2)
+ .strokeBorder(Color.onSurfacePrimary.opacity(0.15), lineWidth: 2)
.opacity(isBordered || theme.borderButtons ? 1 : 0)
}
}
@@ -100,10 +100,10 @@ public struct OversizeButtonStyle: ButtonStyle {
switch type {
case .primary:
switch role {
- case .some(.destructive), .some(.cancel): Color.onPrimaryHighEmphasis
+ case .some(.destructive), .some(.cancel): Color.onPrimary
default:
if isAccent {
- Color.onPrimaryHighEmphasis
+ Color.onPrimary
} else {
Color.backgroundPrimary
}
@@ -116,18 +116,18 @@ public struct OversizeButtonStyle: ButtonStyle {
if isAccent {
Color.accent
} else {
- Color.onSurfaceHighEmphasis
+ Color.onSurfacePrimary
}
}
case .tertiary:
switch role {
case .some(.destructive): Color.error
- case .some(.cancel): Color.onSurfaceHighEmphasis
+ case .some(.cancel): Color.onSurfacePrimary
default:
if isAccent {
Color.accent
} else {
- Color.onSurfaceHighEmphasis
+ Color.onSurfacePrimary
}
}
}
diff --git a/Sources/OversizeUI/Controls/Button/FieldButtonStyle.swift b/Sources/OversizeUI/Controls/Button/FieldButtonStyle.swift
index 5121cbc..2af80b3 100644
--- a/Sources/OversizeUI/Controls/Button/FieldButtonStyle.swift
+++ b/Sources/OversizeUI/Controls/Button/FieldButtonStyle.swift
@@ -7,7 +7,7 @@ import SwiftUI
public struct FieldButtonStyle: ButtonStyle {
@Environment(\.theme) private var theme: ThemeSettings
- @Environment(\.fieldPosition) private var fieldPosition: FieldPosition
+ @Environment(\.fieldPosition) private var fieldPosition: VerticalAlignment?
public init() {}
@@ -24,16 +24,6 @@ public struct FieldButtonStyle: ButtonStyle {
@ViewBuilder
private func fieldBackground(isPressed: Bool) -> some View {
switch fieldPosition {
- case .default:
- RoundedRectangle(cornerRadius: Radius.medium, style: .continuous)
- .fill(isPressed ? Color.surfaceTertiary : Color.surfaceSecondary)
- .overlay(
- RoundedRectangle(cornerRadius: Radius.medium,
- style: .continuous)
- .stroke(theme.borderTextFields
- ? Color.border
- : Color.surfaceSecondary, lineWidth: CGFloat(theme.borderSize))
- )
case .top, .bottom, .center:
#if os(iOS)
RoundedRectangleCorner(radius: Radius.medium, corners: backgroundShapeCorners)
@@ -55,6 +45,17 @@ public struct FieldButtonStyle: ButtonStyle {
: Color.surfaceSecondary, lineWidth: CGFloat(theme.borderSize))
)
#endif
+
+ default:
+ RoundedRectangle(cornerRadius: Radius.medium, style: .continuous)
+ .fill(isPressed ? Color.surfaceTertiary : Color.surfaceSecondary)
+ .overlay(
+ RoundedRectangle(cornerRadius: Radius.medium,
+ style: .continuous)
+ .stroke(theme.borderTextFields
+ ? Color.border
+ : Color.surfaceSecondary, lineWidth: CGFloat(theme.borderSize))
+ )
}
}
@@ -64,14 +65,14 @@ public struct FieldButtonStyle: ButtonStyle {
@available(tvOS, unavailable)
private var backgroundShapeCorners: UIRectCorner {
switch fieldPosition {
- case .default:
- [.allCorners]
case .top:
[.topLeft, .topRight]
case .bottom:
[.bottomLeft, .bottomRight]
case .center:
[]
+ default:
+ [.allCorners]
}
}
#endif
diff --git a/Sources/OversizeUI/Controls/Checkbox/Checkbox.swift b/Sources/OversizeUI/Controls/Checkbox/Checkbox.swift
index 1683531..2a77b9d 100644
--- a/Sources/OversizeUI/Controls/Checkbox/Checkbox.swift
+++ b/Sources/OversizeUI/Controls/Checkbox/Checkbox.swift
@@ -5,7 +5,7 @@
import SwiftUI
-public enum CheckboxAlignment {
+public enum CheckboxAlignment: Sendable {
case leading, trailing
}
@@ -77,7 +77,7 @@ public struct Checkbox: View {
private func checkboxImage(isEnabled: Bool, isOn: Bool) -> some View {
ZStack {
RoundedRectangle(cornerRadius: Radius.small, style: .continuous)
- .strokeBorder(Color.onSurfaceDisabled.opacity(isEnabled ? 1 : 0.5), lineWidth: 2.5)
+ .strokeBorder(Color.onSurfaceTertiary.opacity(isEnabled ? 1 : 0.5), lineWidth: 2.5)
.frame(width: 24, height: 24)
.opacity(isOn ? 0 : 1)
@@ -87,16 +87,16 @@ public struct Checkbox: View {
Image(systemName: "checkmark")
.font(.caption.weight(.black))
- .foregroundColor(.onPrimaryHighEmphasis.opacity(isEnabled ? 1 : 0.5))
+ .foregroundColor(.onPrimary.opacity(isEnabled ? 1 : 0.5))
.opacity(isOn ? 1 : 0)
}
}
private var foregroundColor: Color {
if isEnabled {
- Color.onSurfaceHighEmphasis
+ Color.onSurfacePrimary
} else {
- Color.onSurfaceDisabled
+ Color.onSurfaceTertiary
}
}
}
@@ -115,16 +115,18 @@ public extension Checkbox where Label == EmptyView {
}
}
-struct Checkbox_LibraryContent: LibraryContentProvider {
- var views: [LibraryItem] {
- LibraryItem(
- Checkbox(isOn: .constant(false), label: {
- Text("Text")
- }),
- title: "Checkbox", category: .control
- )
- }
-}
+/*
+ struct Checkbox_LibraryContent: LibraryContentProvider {
+ var views: [LibraryItem] {
+ LibraryItem(
+ Checkbox(isOn: .constant(false), label: {
+ Text("Text")
+ }),
+ title: "Checkbox", category: .control
+ )
+ }
+ }
+ */
struct Checkbox_preview: PreviewProvider {
static var previews: some View {
diff --git a/Sources/OversizeUI/Controls/ColorSelector/ColorSelectorStyle.swift b/Sources/OversizeUI/Controls/ColorSelector/ColorSelectorStyle.swift
index 03f792a..42ae91a 100644
--- a/Sources/OversizeUI/Controls/ColorSelector/ColorSelectorStyle.swift
+++ b/Sources/OversizeUI/Controls/ColorSelector/ColorSelectorStyle.swift
@@ -5,14 +5,14 @@
import SwiftUI
-public protocol ColorSelectorStyle {
+public protocol ColorSelectorStyle: Sendable {
associatedtype Body: View
typealias Configuration = ColorSelectorConfiguration
func makeBody(configuration: Self.Configuration) -> Self.Body
}
-public struct ColorSelectorConfiguration {
+public struct ColorSelectorConfiguration: Sendable {
public struct Label: View {
public init(content: some View) {
body = AnyView(content)
@@ -31,7 +31,7 @@ public struct DefaultColorSelectorStyle: ColorSelectorStyle {
}
struct ColorSelectorStyleStyleKey: EnvironmentKey {
- public static var defaultValue = AnyColorSelectorStyle(style: DefaultColorSelectorStyle())
+ public static let defaultValue = AnyColorSelectorStyle(style: DefaultColorSelectorStyle())
}
public extension EnvironmentValues {
diff --git a/Sources/OversizeUI/Controls/ColorSelector/Styles/AnyColorSelectorStyle.swift b/Sources/OversizeUI/Controls/ColorSelector/Styles/AnyColorSelectorStyle.swift
index 2ce0164..e99bffd 100644
--- a/Sources/OversizeUI/Controls/ColorSelector/Styles/AnyColorSelectorStyle.swift
+++ b/Sources/OversizeUI/Controls/ColorSelector/Styles/AnyColorSelectorStyle.swift
@@ -6,7 +6,7 @@
import SwiftUI
public struct AnyColorSelectorStyle: ColorSelectorStyle {
- private var _makeBody: (Configuration) -> AnyView
+ private var _makeBody: @Sendable (Configuration) -> AnyView
public init(style: some ColorSelectorStyle) {
_makeBody = { configuration in
diff --git a/Sources/OversizeUI/Controls/DateField/DateField.swift b/Sources/OversizeUI/Controls/DateField/DateField.swift
index 0e6092e..2033480 100644
--- a/Sources/OversizeUI/Controls/DateField/DateField.swift
+++ b/Sources/OversizeUI/Controls/DateField/DateField.swift
@@ -46,7 +46,7 @@ public struct DateField: View {
HStack {
Text(label)
.subheadline(.medium)
- .foregroundColor(.onSurfaceHighEmphasis)
+ .foregroundColor(.onSurfacePrimary)
Spacer()
}
}
@@ -58,7 +58,7 @@ public struct DateField: View {
Text(label)
.font(.subheadline)
.fontWeight(.semibold)
- .onSurfaceDisabledForegroundColor()
+ .onSurfaceTertiaryForeground()
}
HStack {
diff --git a/Sources/OversizeUI/Controls/GridSelect/GridSelect.swift b/Sources/OversizeUI/Controls/GridSelect/GridSelect.swift
index 966af35..44a0d86 100644
--- a/Sources/OversizeUI/Controls/GridSelect/GridSelect.swift
+++ b/Sources/OversizeUI/Controls/GridSelect/GridSelect.swift
@@ -122,7 +122,7 @@ public struct GridSelect: View
RoundedRectangle(cornerRadius: radius,
style: .continuous)
- .strokeBorder(Color.onSurfaceMediumEmphasis, lineWidth: 2)
+ .strokeBorder(Color.onSurfaceSecondary, lineWidth: 2)
case .accentSurface:
RoundedRectangle(cornerRadius: radius.rawValue,
style: .continuous)
@@ -163,7 +163,7 @@ public struct GridSelect: View
Circle()
.foregroundColor(Color.surfacePrimary)
.shadowElevaton(.z2)
- IconDeprecated(.checkMini, color: .onSurfaceHighEmphasis)
+ IconDeprecated(.checkMini, color: .onSurfacePrimary)
}.frame(width: Space.large.rawValue, height: Space.large.rawValue)
.padding(.small)
}
diff --git a/Sources/OversizeUI/Controls/GridSelect/GridSelectStyle.swift b/Sources/OversizeUI/Controls/GridSelect/GridSelectStyle.swift
index 0023816..d097c13 100644
--- a/Sources/OversizeUI/Controls/GridSelect/GridSelectStyle.swift
+++ b/Sources/OversizeUI/Controls/GridSelect/GridSelectStyle.swift
@@ -57,24 +57,24 @@ public struct SelectionOnlyGridSelectStyle: GridSelectStyle {
// MARK: - Support
-public enum GridSelectSeletionIconStyle {
+public enum GridSelectSeletionIconStyle: Sendable {
case none
case checkbox(alignment: Alignment = .bottomTrailing)
case radio(alignment: Alignment = .bottomTrailing)
}
-public enum GridSelectSeletionStyle {
+public enum GridSelectSeletionStyle: Sendable {
case shadowSurface
case graySurface
case accentSurface
}
-public enum GridSelectUnseletionStyle {
+public enum GridSelectUnseletionStyle: Sendable {
case clean
case surface
}
-public protocol GridSelectStyle {
+public protocol GridSelectStyle: Sendable {
associatedtype Body: View
typealias Configuration = GridSelectConfiguration
@@ -103,7 +103,7 @@ public struct AnyGridSelectStyle: GridSelectStyle {
public var unseletionStyle: GridSelectUnseletionStyle
public var icon: GridSelectSeletionIconStyle
- private var _makeBody: (Configuration) -> AnyView
+ private var _makeBody: @Sendable (Configuration) -> AnyView
public init(
seletionStyle: GridSelectSeletionStyle,
@@ -125,7 +125,7 @@ public struct AnyGridSelectStyle: GridSelectStyle {
}
struct GridSelectStyleKey: EnvironmentKey {
- public static var defaultValue = AnyGridSelectStyle(seletionStyle: .accentSurface,
+ public static let defaultValue = AnyGridSelectStyle(seletionStyle: .accentSurface,
unseletionStyle: .surface,
icon: .none,
style: IslandGridSelectStyle())
diff --git a/Sources/OversizeUI/Controls/HUD/HUD.swift b/Sources/OversizeUI/Controls/HUD/HUD.swift
index eff6dc4..81e9b21 100644
--- a/Sources/OversizeUI/Controls/HUD/HUD.swift
+++ b/Sources/OversizeUI/Controls/HUD/HUD.swift
@@ -14,8 +14,12 @@ public struct HUD: View where Title: View, Icon: View {
private let isAutoHide: Bool
@Binding private var isPresented: Bool
+ #if os(macOS)
+ @State private var offset: CGFloat = 200
+ #else
+ @State private var offset: CGFloat = -200
+ #endif
- @State private var bottomOffset: CGFloat = 0
@State private var opacity: CGFloat = 0
// MARK: Initializers
@@ -41,7 +45,12 @@ public struct HUD: View where Title: View, Icon: View {
if let text {
Text(text)
.body(.medium)
- .foregroundColor(.onSurfaceHighEmphasis)
+ #if os(macOS)
+ .foregroundColor(Color.onPrimary)
+ #else
+ .foregroundColor(Color.onSurfacePrimary)
+
+ #endif
} else if let title {
title
@@ -50,26 +59,41 @@ public struct HUD: View where Title: View, Icon: View {
.padding(.leading, icon == nil ? .medium : .small)
.padding(.trailing, .medium)
.padding(.vertical, .xSmall)
- .background(
- Capsule()
- .foregroundColor(Color.surfacePrimary)
- .shadowElevaton(.z2)
- )
- .padding(.small)
- .opacity(opacity)
- .offset(y: bottomOffset)
- .onChange(of: isPresented, perform: { present in
- if present {
- presentAnimated()
- } else {
- dismissAnimated()
+ #if os(macOS)
+ .background(
+ RoundedRectangle(cornerRadius: .small, style: .continuous)
+ .foregroundColor(Color.onBackgroundPrimary)
+ .shadowElevaton(.z2)
+ )
+ #else
+ .background(
+ Capsule()
+ .foregroundColor(Color.surfacePrimary)
+ .shadowElevaton(.z2)
+ )
+ #endif
+ .padding(.small)
+ .opacity(opacity)
+ .offset(y: offset)
+ .onChange(of: isPresented) { present in
+ if present {
+ if offset == 0 {
+ dismissAnimated()
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
+ presentAnimated()
+ }
+ } else {
+ presentAnimated()
+ }
+ } else {
+ dismissAnimated()
+ }
}
- })
}
private func presentAnimated() {
withAnimation {
- bottomOffset = 0
+ offset = 0
opacity = 1
}
if isAutoHide {
@@ -83,7 +107,11 @@ public struct HUD: View where Title: View, Icon: View {
private func dismissAnimated() {
withAnimation {
- bottomOffset = -200
+ #if os(macOS)
+ offset = 200
+ #else
+ offset = -200
+ #endif
opacity = 0
}
}
@@ -132,10 +160,46 @@ public extension HUD where Icon == EmptyView {
}
}
+#if os(macOS)
+@MainActor
+public extension View {
+ func hud(_ text: String, autoHide: Bool = true, isPresented: Binding) -> some View {
+ overlay(alignment: .bottomTrailing) {
+ HUD(text, autoHide: autoHide, isPresented: isPresented)
+ }
+ }
+
+ func hud(_ text: String, isPresented: Binding, @ViewBuilder icon: () -> some View) -> some View {
+ overlay(alignment: .bottomTrailing) {
+ HUD(text, isPresented: isPresented, icon: icon)
+ }
+ }
+
+ func hud(isPresented: Binding, @ViewBuilder title: () -> some View) -> some View {
+ overlay(alignment: .bottomTrailing) {
+ HUD(isPresented: isPresented, title: title)
+ }
+ }
+
+ func hud(isPresented: Binding, @ViewBuilder title: () -> some View, @ViewBuilder icon: () -> some View) -> some View {
+ overlay(alignment: .bottomTrailing) {
+ HUD(isPresented: isPresented, title: title, icon: icon)
+ }
+ }
+
+ func hudLoader(_ text: String = "Loading", isPresented: Binding) -> some View {
+ overlay(alignment: .bottomTrailing) {
+ HUD(text, autoHide: false, isPresented: isPresented) {
+ ProgressView()
+ }
+ }
+ }
+}
+#else
public extension View {
- func hud(_ text: String, isPresented: Binding) -> some View {
+ func hud(_ text: String, autoHide: Bool = true, isPresented: Binding) -> some View {
overlay(alignment: .top) {
- HUD(text, isPresented: isPresented)
+ HUD(text, autoHide: autoHide, isPresented: isPresented)
}
}
@@ -165,3 +229,4 @@ public extension View {
}
}
}
+#endif
diff --git a/Sources/OversizeUI/Controls/IconPicker/IconPicker.swift b/Sources/OversizeUI/Controls/IconPicker/IconPicker.swift
index dd1ca6d..ba5562d 100644
--- a/Sources/OversizeUI/Controls/IconPicker/IconPicker.swift
+++ b/Sources/OversizeUI/Controls/IconPicker/IconPicker.swift
@@ -5,9 +5,7 @@
import SwiftUI
-@available(macOS, unavailable)
-@available(watchOS, unavailable)
-@available(tvOS, unavailable)
+#if os(iOS)
public struct IconPicker: View {
@Environment(\.theme) private var theme: ThemeSettings
@Environment(\.horizontalSizeClass) var horizontalSizeClass
@@ -47,13 +45,13 @@ public struct IconPicker: View {
} label: {
HStack(spacing: .xxSmall) {
Text(label)
- .onSurfaceHighEmphasisForegroundColor()
+ .onSurfacePrimaryForeground()
Spacer()
if let image = selection {
image
}
- IconDeprecated(.chevronDown, color: .onSurfaceHighEmphasis)
+ IconDeprecated(.chevronDown, color: .onSurfacePrimary)
}
}
.buttonStyle(.field)
@@ -109,3 +107,4 @@ public struct IconPicker: View {
}
}
}
+#endif
diff --git a/Sources/OversizeUI/Controls/Label/MenuLabelStyle.swift b/Sources/OversizeUI/Controls/Label/MenuLabelStyle.swift
index 123b34b..1d10c74 100644
--- a/Sources/OversizeUI/Controls/Label/MenuLabelStyle.swift
+++ b/Sources/OversizeUI/Controls/Label/MenuLabelStyle.swift
@@ -19,17 +19,17 @@ public struct MenuLabelStyle: LabelStyle {
HStack(spacing: .xSmall) {
configuration.icon
.headline()
- .foregroundColor(.onSurfaceHighEmphasis)
+ .foregroundColor(.onSurfacePrimary)
VStack(alignment: textAlignment, spacing: .xxxSmall) {
configuration.title
.headline(.semibold)
- .foregroundColor(.onSurfaceHighEmphasis)
+ .foregroundColor(.onSurfacePrimary)
if let subtitle, !subtitle.isEmpty {
Text(subtitle)
.subheadline()
- .foregroundColor(.onSurfaceMediumEmphasis)
+ .foregroundColor(.onSurfaceSecondary)
}
}
}
diff --git a/Sources/OversizeUI/Controls/Label/RowLabelStyle.swift b/Sources/OversizeUI/Controls/Label/RowLabelStyle.swift
index 03d808f..7f43f24 100644
--- a/Sources/OversizeUI/Controls/Label/RowLabelStyle.swift
+++ b/Sources/OversizeUI/Controls/Label/RowLabelStyle.swift
@@ -19,17 +19,17 @@ public struct RowLabelStyle: LabelStyle {
HStack(spacing: .xSmall) {
configuration.icon
.headline()
- .foregroundColor(.onSurfaceHighEmphasis)
+ .foregroundColor(.onSurfacePrimary)
VStack(alignment: textAlignment, spacing: .xxxSmall) {
configuration.title
.headline(.semibold)
- .foregroundColor(.onSurfaceHighEmphasis)
+ .foregroundColor(.onSurfacePrimary)
if let subtitle, !subtitle.isEmpty {
Text(subtitle)
.subheadline()
- .foregroundColor(.onSurfaceMediumEmphasis)
+ .foregroundColor(.onSurfaceSecondary)
}
}
}
diff --git a/Sources/OversizeUI/Controls/Loader/LoaderOverlayView.swift b/Sources/OversizeUI/Controls/Loader/LoaderOverlayView.swift
index 2d09d66..155bc71 100644
--- a/Sources/OversizeUI/Controls/Loader/LoaderOverlayView.swift
+++ b/Sources/OversizeUI/Controls/Loader/LoaderOverlayView.swift
@@ -59,7 +59,7 @@ public struct LoaderOverlayView: View {
if showText {
Text(text.isEmpty ? "Loading" : text)
.headline(.semibold)
- .onSurfaceDisabledForegroundColor()
+ .onSurfaceTertiaryForeground()
.offset(y: 8)
}
}
@@ -74,7 +74,7 @@ public struct LoaderOverlayView: View {
if showText {
Text(text.isEmpty ? "Loading" : text)
.headline(.semibold)
- .onSurfaceDisabledForegroundColor()
+ .onSurfaceTertiaryForeground()
.offset(y: 8)
}
}
diff --git a/Sources/OversizeUI/Controls/Menu/BarButtonMenuStyle.swift b/Sources/OversizeUI/Controls/Menu/BarButtonMenuStyle.swift
index d755346..1b6a4fe 100644
--- a/Sources/OversizeUI/Controls/Menu/BarButtonMenuStyle.swift
+++ b/Sources/OversizeUI/Controls/Menu/BarButtonMenuStyle.swift
@@ -17,7 +17,7 @@ public struct BarButtonMenuStyle: MenuStyle {
public func makeBody(configuration: Configuration) -> some View {
Menu(configuration)
.body(true)
- .foregroundColor(Color.onPrimaryHighEmphasis)
+ .foregroundColor(Color.onPrimary)
.padding(.xxSmall)
.background(background)
.shadowElevaton(.z2)
@@ -28,7 +28,7 @@ public struct BarButtonMenuStyle: MenuStyle {
.fill(Color.surfacePrimary)
.overlay {
Capsule()
- .strokeBorder(Color.onSurfaceHighEmphasis.opacity(0.15), lineWidth: 2)
+ .strokeBorder(Color.onSurfacePrimary.opacity(0.15), lineWidth: 2)
.opacity(isBordered || theme.borderButtons ? 1 : 0)
}
}
diff --git a/Sources/OversizeUI/Controls/Notice/NoticeView.swift b/Sources/OversizeUI/Controls/Notice/NoticeView.swift
index 77bd0cb..71ecae7 100644
--- a/Sources/OversizeUI/Controls/Notice/NoticeView.swift
+++ b/Sources/OversizeUI/Controls/Notice/NoticeView.swift
@@ -52,7 +52,7 @@ public struct NoticeView: View where A: View {
Text(title)
.headline(.semibold)
- .onSurfaceHighEmphasisForegroundColor()
+ .onSurfacePrimaryForeground()
.multilineTextAlignment(.leading)
.padding(.trailing, closeAction != nil ? .medium : .zero)
}
@@ -60,7 +60,7 @@ public struct NoticeView: View where A: View {
subtitle.map { text in
Text(text)
.body(.medium)
- .onSurfaceMediumEmphasisForegroundColor()
+ .onSurfaceSecondaryForeground()
.multilineTextAlignment(.leading)
}
@@ -83,7 +83,7 @@ public struct NoticeView: View where A: View {
Button {
closeAction?()
} label: {
- IconDeprecated(.xMini, color: .onSurfaceHighEmphasis)
+ IconDeprecated(.xMini, color: .onSurfacePrimary)
}
.buttonStyle(subtitle != nil ? .tertiary(infinityWidth: false) : .quaternary(infinityWidth: false))
.controlBorderShape(.capsule)
diff --git a/Sources/OversizeUI/Controls/PageControl/PageIndexView.swift b/Sources/OversizeUI/Controls/PageControl/PageIndexView.swift
index 72d48c3..5fc08ef 100644
--- a/Sources/OversizeUI/Controls/PageControl/PageIndexView.swift
+++ b/Sources/OversizeUI/Controls/PageControl/PageIndexView.swift
@@ -19,7 +19,11 @@ public struct PageIndexView: View {
ForEach(0 ..< maxIndex, id: \.self) { index in
Capsule()
.fill(index == self.index ? Color.accent : Color.surfaceTertiary)
+ #if os(iOS)
.frame(width: index == self.index ? 28 : 8, height: 8)
+ #else
+ .frame(width: index == self.index ? 24 : 6, height: 6)
+ #endif
.animation(.default, value: index)
}
}
diff --git a/Sources/OversizeUI/Controls/PageView/Page.swift b/Sources/OversizeUI/Controls/PageView/Page.swift
index 9709c53..ab1f07a 100644
--- a/Sources/OversizeUI/Controls/PageView/Page.swift
+++ b/Sources/OversizeUI/Controls/PageView/Page.swift
@@ -4,6 +4,8 @@ import SwiftUI
public struct Page: View
where Content: View, Header: View, LeadingBar: View, TrailingBar: View, TopToolbar: View, TitleLabel: View
{
+ @Environment(\.platform) var platform
+
public typealias ScrollAction = (_ offset: CGPoint, _ headerVisibleRatio: CGFloat) -> Void
private let title: String?
@@ -103,7 +105,7 @@ public struct Page 20 ? opacity : 0))
+ .foregroundColor(Color.onSurfaceTertiary.opacity(height > 20 ? opacity : 0))
configuration.label
.frame(maxWidth: .infinity, alignment: .leading)
- .foregroundColor(Color.onSurfaceDisabled.opacity(height > 20 ? opacity : 0))
+ .foregroundColor(Color.onSurfaceTertiary.opacity(height > 20 ? opacity : 0))
}
.callout(.semibold)
@@ -1100,7 +1102,7 @@ struct SeartchTextFieldButtonStyle: ButtonStyle {
cornerRadius: .medium,
style: .continuous
)
- .fill(Color.onSurfaceHighEmphasis.opacity(0.07))
+ .fill(Color.onSurfacePrimary.opacity(0.07))
)
.submitLabel(.search)
}
@@ -1109,7 +1111,7 @@ struct SeartchTextFieldButtonStyle: ButtonStyle {
private extension View {
@ViewBuilder
func prefersNavigationBarHidden() -> some View {
- #if os(watchOS)
+ #if os(watchOS) || os(macOS)
self
#else
if #available(iOS 16.0, macOS 13.0, tvOS 16.0, *) {
diff --git a/Sources/OversizeUI/Controls/Premium/PremiumLabel.swift b/Sources/OversizeUI/Controls/Premium/PremiumLabel.swift
index bb5a27f..1cde093 100644
--- a/Sources/OversizeUI/Controls/Premium/PremiumLabel.swift
+++ b/Sources/OversizeUI/Controls/Premium/PremiumLabel.swift
@@ -33,11 +33,11 @@ public struct PremiumLabel: View {
if let image {
image
.renderingMode(.template)
- .foregroundColor(isMonohrom ? Color(red: 0.718, green: 0.325, blue: 0.459) : .onPrimaryHighEmphasis)
+ .foregroundColor(isMonohrom ? Color(red: 0.718, green: 0.325, blue: 0.459) : .onPrimary)
}
Text(text)
.font(.system(size: fontSize, weight: .heavy))
- .foregroundColor(isMonohrom ? Color(red: 0.718, green: 0.325, blue: 0.459) : .onPrimaryHighEmphasis)
+ .foregroundColor(isMonohrom ? Color(red: 0.718, green: 0.325, blue: 0.459) : .onPrimary)
}
.padding(.leading, leadingPadding)
.padding(.trailing, trailingPadding)
@@ -47,7 +47,7 @@ public struct PremiumLabel: View {
Group {
if isMonohrom {
RoundedRectangle(cornerRadius: radius, style: .continuous)
- .fill(Color.onPrimaryHighEmphasis)
+ .fill(Color.onPrimary)
} else {
RoundedRectangle(cornerRadius: radius, style: .continuous)
.fill(LinearGradient(gradient: Gradient(colors: [
diff --git a/Sources/OversizeUI/Controls/PriceField/PriceField.swift b/Sources/OversizeUI/Controls/PriceField/PriceField.swift
index 8495391..4f19577 100644
--- a/Sources/OversizeUI/Controls/PriceField/PriceField.swift
+++ b/Sources/OversizeUI/Controls/PriceField/PriceField.swift
@@ -9,7 +9,7 @@ import SwiftUI
import UIKit
#endif
-@available(macOS 13, iOS 16, tvOS 16, watchOS 9, *)
+@available(macOS 14, iOS 16, tvOS 16, watchOS 9, *)
public struct PriceField: View {
private var formatter: NumberFormatter {
let formatter = NumberFormatter()
diff --git a/Sources/OversizeUI/Controls/Radio/Radio.swift b/Sources/OversizeUI/Controls/Radio/Radio.swift
index 4bc8a4f..ccd7f4a 100644
--- a/Sources/OversizeUI/Controls/Radio/Radio.swift
+++ b/Sources/OversizeUI/Controls/Radio/Radio.swift
@@ -82,7 +82,7 @@ public struct Radio: View {
private func radioImage(isEnabled: Bool, isOn: Bool) -> some View {
ZStack {
Circle()
- .stroke(Color.onSurfaceDisabled.opacity(isEnabled ? 1 : 0.5), lineWidth: 4)
+ .stroke(Color.onSurfaceTertiary.opacity(isEnabled ? 1 : 0.5), lineWidth: 4)
.frame(width: 24, height: 24)
.cornerRadius(12)
.opacity(isOn ? 0 : 1)
@@ -100,9 +100,9 @@ public struct Radio: View {
private var foregroundColor: Color {
if isEnabled {
- Color.onSurfaceHighEmphasis
+ Color.onSurfacePrimary
} else {
- Color.onSurfaceDisabled
+ Color.onSurfaceTertiary
}
}
}
@@ -121,16 +121,18 @@ public extension Radio where Label == EmptyView {
}
}
-struct Radio_LibraryContent: LibraryContentProvider {
- var views: [LibraryItem] {
- LibraryItem(
- Radio(isOn: false, alignment: .leading, label: {
- Text("Text")
- }),
- title: "Chip", category: .control
- )
- }
-}
+/*
+ struct Radio_LibraryContent: LibraryContentProvider {
+ var views: [LibraryItem] {
+ LibraryItem(
+ Radio(isOn: false, alignment: .leading, label: {
+ Text("Text")
+ }),
+ title: "Chip", category: .control
+ )
+ }
+ }
+ */
struct Radio_preview: PreviewProvider {
struct RadioPreview: View {
diff --git a/Sources/OversizeUI/Controls/Radio/RadioPicker.swift b/Sources/OversizeUI/Controls/Radio/RadioPicker.swift
index 0663843..d05b5d2 100644
--- a/Sources/OversizeUI/Controls/Radio/RadioPicker.swift
+++ b/Sources/OversizeUI/Controls/Radio/RadioPicker.swift
@@ -54,16 +54,18 @@ public struct RadioPicker: View where Content: View
}
}
-struct RadioPicker_LibraryContent: LibraryContentProvider {
- var views: [LibraryItem] {
- LibraryItem(
- RadioPicker(["One", "Two"], selection: .constant("One")) { item in
- Text(item)
- },
- title: "Radio Picker", category: .control
- )
- }
-}
+/*
+ struct RadioPicker_LibraryContent: LibraryContentProvider {
+ var views: [LibraryItem] {
+ LibraryItem(
+ RadioPicker(["One", "Two"], selection: .constant("One")) { item in
+ Text(item)
+ },
+ title: "Radio Picker", category: .control
+ )
+ }
+ }
+ */
struct RadioPicker_previw: PreviewProvider {
struct RadioPickerPreview: View {
diff --git a/Sources/OversizeUI/Controls/Row/Row.swift b/Sources/OversizeUI/Controls/Row/Row.swift
index 95f0e65..5a175d4 100644
--- a/Sources/OversizeUI/Controls/Row/Row.swift
+++ b/Sources/OversizeUI/Controls/Row/Row.swift
@@ -26,9 +26,6 @@ public struct Row: View where LeadingLabel: View, T
private let leadingLabel: LeadingLabel?
private let trailingLabel: TrailingLabel?
- private var leadingType: RowLeadingType?
- private var trallingType: RowTrailingType?
-
private let action: (() -> Void)?
private var isPremiumOption = false
@@ -63,26 +60,6 @@ public struct Row: View where LeadingLabel: View, T
leadingRadius = nil
}
- @available(*, deprecated, message: "Use leading: {} and tralling: {}")
- public init(_ title: String,
- subtitle: String? = nil,
- leadingType: RowLeadingType? = nil,
- trallingType: RowTrailingType? = nil,
- paddingHorizontal _: Space = .medium,
- paddingVertical _: Space = .small,
- action: (() -> Void)? = nil)
- {
- self.title = title
- self.subtitle = subtitle
- self.leadingType = leadingType
- self.trallingType = trallingType
- self.action = action
- leadingLabel = nil
- trailingLabel = nil
- leadingSize = nil
- leadingRadius = nil
- }
-
public var body: some View {
if action != nil {
Button {
@@ -132,7 +109,7 @@ public struct Row: View where LeadingLabel: View, T
if isShowArrowIcon {
Image.Base.chevronRight
- .icon(.onSurfaceDisabled)
+ .icon(.onSurfaceTertiary)
}
}
}
@@ -160,7 +137,7 @@ public struct Row: View where LeadingLabel: View, T
сlearAction?()
} label: {
ZStack {
- IconDeprecated(.xMini, color: .onSurfaceDisabled)
+ IconDeprecated(.xMini, color: .onSurfaceTertiary)
.background(
RoundedRectangle(cornerRadius: .small, style: .continuous)
.fillSurfaceSecondary()
@@ -183,7 +160,7 @@ public struct Row: View where LeadingLabel: View, T
if let textColor {
textColor
} else {
- Color.onSurfaceHighEmphasis
+ Color.onSurfacePrimary
}
}
@@ -191,7 +168,7 @@ public struct Row: View where LeadingLabel: View, T
if let textColor {
textColor
} else {
- Color.onSurfaceMediumEmphasis
+ Color.onSurfaceSecondary
}
}
@@ -246,20 +223,6 @@ public extension Row {
control.textColor = color
return control
}
-
- @available(*, deprecated, message: "Use leading: {} and tralling: {}")
- func rowLeading(_ leading: RowLeadingType?) -> Row {
- var control = self
- control.leadingType = leading
- return control
- }
-
- @available(*, deprecated, message: "Use leading: {} and tralling: {}")
- func rowTrailing(_ trailing: RowTrailingType?) -> Row {
- var control = self
- control.trallingType = trailing
- return control
- }
}
public extension View {
diff --git a/Sources/OversizeUI/Controls/Row/RowButton.swift b/Sources/OversizeUI/Controls/Row/RowButton.swift
index 14cec4f..df27aef 100644
--- a/Sources/OversizeUI/Controls/Row/RowButton.swift
+++ b/Sources/OversizeUI/Controls/Row/RowButton.swift
@@ -68,6 +68,6 @@ public struct RowButton: View {
? Color.link
: style == .delete
? Color.error
- : Color.onSurfaceHighEmphasis
+ : Color.onSurfacePrimary
}
}
diff --git a/Sources/OversizeUI/Controls/Row/RowTitle.swift b/Sources/OversizeUI/Controls/Row/RowTitle.swift
index b5d641d..fd40d25 100644
--- a/Sources/OversizeUI/Controls/Row/RowTitle.swift
+++ b/Sources/OversizeUI/Controls/Row/RowTitle.swift
@@ -44,14 +44,14 @@ public struct RowTitle: View {
} label: {
Text(title)
.font(.title2.bold())
- .foregroundColor(.onSurfaceHighEmphasis)
+ .foregroundColor(.onSurfacePrimary)
}
.buttonStyle(.scale)
}
} else {
Text(title)
.font(.title2.bold())
- .foregroundColor(.onSurfaceHighEmphasis)
+ .foregroundColor(.onSurfacePrimary)
}
}
@@ -63,7 +63,7 @@ public struct RowTitle: View {
action()
} label: {
IconDeprecated(.chevronRight)
- .iconColor(.onSurfaceMediumEmphasis)
+ .iconColor(.onSurfaceSecondary)
.offset(y: titleButtonPosition == .leading ? 1.5 : 0)
}
.buttonStyle(.scale)
diff --git a/Sources/OversizeUI/Controls/ScrollView/ScrollViewWithStickyHeader.swift b/Sources/OversizeUI/Controls/ScrollView/ScrollViewWithStickyHeader.swift
index d66930a..415d37a 100644
--- a/Sources/OversizeUI/Controls/ScrollView/ScrollViewWithStickyHeader.swift
+++ b/Sources/OversizeUI/Controls/ScrollView/ScrollViewWithStickyHeader.swift
@@ -1,7 +1,7 @@
-////
-//// Copyright © 2023 Alexander Romanov
-//// File.swift, created on 26.11.2023
-////
+//
+// Copyright © 2023 Alexander Romanov
+// ScrollViewHeader.swift, created on 26.11.2023
+//
//
import SwiftUI
diff --git a/Sources/OversizeUI/Controls/SectionView/SectionView.swift b/Sources/OversizeUI/Controls/SectionView/SectionView.swift
index 9822275..fe86bbf 100644
--- a/Sources/OversizeUI/Controls/SectionView/SectionView.swift
+++ b/Sources/OversizeUI/Controls/SectionView/SectionView.swift
@@ -5,20 +5,20 @@
import SwiftUI
-public enum SectionViewTitlePosition {
+public enum SectionViewTitlePosition: Sendable {
case inside, outside
}
-public enum SectionViewTitleButtonPosition {
+public enum SectionViewTitleButtonPosition: Sendable {
case leading, trailing
}
-public enum SectionViewTitleButton {
- case arrow(_ action: () -> Void)
- case title(_ title: String, _ action: () -> Void)
+public enum SectionViewTitleButton: Sendable {
+ case arrow(_ action: @Sendable () -> Void)
+ case title(_ title: String, _ action: @Sendable () -> Void)
}
-public enum SectionViewStyle {
+public enum SectionViewStyle: Sendable {
case `default`, smallIndent, edgeToEdge
}
@@ -106,9 +106,9 @@ public struct SectionView: View {
private var titleColor: Color {
switch titlePosition {
case .inside:
- .onSurfaceHighEmphasis
+ .onSurfacePrimary
case .outside:
- .onBackgroundHighEmphasis
+ .onBackgroundPrimary
}
}
@@ -141,7 +141,7 @@ public struct SectionView: View {
action()
} label: {
IconDeprecated(.chevronRight)
- .iconColor(.onSurfaceMediumEmphasis)
+ .iconColor(.onSurfaceSecondary)
.offset(y: titleButtonPosition == .leading ? 1.5 : 0)
}
.buttonStyle(.scale)
diff --git a/Sources/OversizeUI/Controls/SegmentedControl/SegmentedControl.swift b/Sources/OversizeUI/Controls/SegmentedControl/SegmentedControl.swift
index ae428a1..6c32c51 100644
--- a/Sources/OversizeUI/Controls/SegmentedControl/SegmentedControl.swift
+++ b/Sources/OversizeUI/Controls/SegmentedControl/SegmentedControl.swift
@@ -105,7 +105,7 @@ public struct SegmentedPickerSelector: V
content(data[index],
selectedIndex == index)
.body(.semibold)
- .foregroundColor(style.seletionStyle == .accentSurface && selectedIndex == index ? Color.onPrimaryHighEmphasis : Color.onSurfaceHighEmphasis)
+ .foregroundColor(style.seletionStyle == .accentSurface && selectedIndex == index ? Color.onPrimary : Color.onSurfacePrimary)
.multilineTextAlignment(.center)
.contentShape(Rectangle())
.frame(
@@ -173,7 +173,7 @@ public struct SegmentedPickerSelector: V
},
label: { content(data[index], selectedIndex == index)
.body(.semibold)
- .foregroundColor(style.seletionStyle == .accentSurface && selectedIndex == index ? Color.onPrimaryHighEmphasis : Color.onSurfaceHighEmphasis)
+ .foregroundColor(style.seletionStyle == .accentSurface && selectedIndex == index ? Color.onPrimary : Color.onSurfacePrimary)
.multilineTextAlignment(.center)
.padding(.leading, controlPadding.leading)
.padding(.trailing, controlPadding.trailing)
@@ -244,7 +244,7 @@ public struct SegmentedPickerSelector: V
? controlRadius.rawValue - 4
: controlRadius.rawValue,
style: .continuous)
- .strokeBorder(Color.onSurfaceMediumEmphasis, lineWidth: 2)
+ .strokeBorder(Color.onSurfaceSecondary, lineWidth: 2)
}
case .accentSurface:
RoundedRectangle(
diff --git a/Sources/OversizeUI/Controls/SegmentedControl/SegmentedControlStyle.swift b/Sources/OversizeUI/Controls/SegmentedControl/SegmentedControlStyle.swift
index 29286b9..7d634db 100644
--- a/Sources/OversizeUI/Controls/SegmentedControl/SegmentedControlStyle.swift
+++ b/Sources/OversizeUI/Controls/SegmentedControl/SegmentedControlStyle.swift
@@ -7,7 +7,7 @@ import SwiftUI
// MARK: - Styles
-public enum SegmentedControlStyleType {
+public enum SegmentedControlStyleType: Sendable {
case `default`
case island(selected: SegmentedControlSeletionStyle = .shadowSurface)
case islandLeading(selected: SegmentedControlSeletionStyle = .shadowSurface)
@@ -17,13 +17,13 @@ public enum SegmentedControlStyleType {
case onlySelectionScroll(selected: SegmentedControlSeletionStyle = .shadowSurface)
}
-public enum SegmentedControlSeletionStyle {
+public enum SegmentedControlSeletionStyle: Sendable {
case shadowSurface
case graySurface
case accentSurface
}
-public enum SegmentedControlUnseletionStyle {
+public enum SegmentedControlUnseletionStyle: Sendable {
case clean
case surface
}
@@ -35,66 +35,94 @@ public extension View {
case .default:
let style: RectangleSegmentedControlStyle = .init()
- return environment(\.segmentedControlStyle,
- AnySegmentedControlStyle(isEquallySpacing: style.isEquallySpacing,
- isShowBackground: style.isShowBackground,
- seletionStyle: style.seletionStyle,
- unseletionStyle: style.unseletionStyle,
- style: style))
+ return environment(
+ \.segmentedControlStyle,
+ AnySegmentedControlStyle(
+ isEquallySpacing: style.isEquallySpacing,
+ isShowBackground: style.isShowBackground,
+ seletionStyle: style.seletionStyle,
+ unseletionStyle: style.unseletionStyle,
+ style: style
+ )
+ )
case let .island(selected: selected):
let style: IslandSegmentedControlStyle = .init()
- return environment(\.segmentedControlStyle,
- AnySegmentedControlStyle(isEquallySpacing: true,
- isShowBackground: false,
- seletionStyle: selected,
- unseletionStyle: .surface,
- style: style))
+ return environment(
+ \.segmentedControlStyle,
+ AnySegmentedControlStyle(
+ isEquallySpacing: true,
+ isShowBackground: false,
+ seletionStyle: selected,
+ unseletionStyle: .surface,
+ style: style
+ )
+ )
case let .islandScroll(selected: selected):
let style: ScrollSegmentedControlStyle = .init()
- return environment(\.segmentedControlStyle,
- AnySegmentedControlStyle(isEquallySpacing: false,
- isShowBackground: false,
- seletionStyle: selected,
- unseletionStyle: .surface,
- style: style))
+ return environment(
+ \.segmentedControlStyle,
+ AnySegmentedControlStyle(
+ isEquallySpacing: false,
+ isShowBackground: false,
+ seletionStyle: selected,
+ unseletionStyle: .surface,
+ style: style
+ )
+ )
case let .onlySelection(selected: selected):
let style: SelectionOnlySegmentedControlStyle = .init()
- return environment(\.segmentedControlStyle,
- AnySegmentedControlStyle(isEquallySpacing: true,
- isShowBackground: false,
- seletionStyle: selected,
- unseletionStyle: .clean,
- style: style))
+ return environment(
+ \.segmentedControlStyle,
+ AnySegmentedControlStyle(
+ isEquallySpacing: true,
+ isShowBackground: false,
+ seletionStyle: selected,
+ unseletionStyle: .clean,
+ style: style
+ )
+ )
case let .onlySelectionLeading(selected: selected):
let style: SelectionOnlySegmentedControlStyle = .init()
- return environment(\.segmentedControlStyle,
- AnySegmentedControlStyle(isEquallySpacing: false,
- isShowBackground: false,
- seletionStyle: selected,
- unseletionStyle: .clean,
- style: style))
+ return environment(
+ \.segmentedControlStyle,
+ AnySegmentedControlStyle(
+ isEquallySpacing: false,
+ isShowBackground: false,
+ seletionStyle: selected,
+ unseletionStyle: .clean,
+ style: style
+ )
+ )
case let .onlySelectionScroll(selected: selected):
let style: ScrollSegmentedControlStyle = .init()
- return environment(\.segmentedControlStyle,
- AnySegmentedControlStyle(isEquallySpacing: false,
- isShowBackground: false,
- seletionStyle: selected,
- unseletionStyle: .clean,
- style: style))
+ return environment(
+ \.segmentedControlStyle,
+ AnySegmentedControlStyle(
+ isEquallySpacing: false,
+ isShowBackground: false,
+ seletionStyle: selected,
+ unseletionStyle: .clean,
+ style: style
+ )
+ )
case let .islandLeading(selected: selected):
let style: IslandSegmentedControlStyle = .init()
- return environment(\.segmentedControlStyle,
- AnySegmentedControlStyle(isEquallySpacing: false,
- isShowBackground: false,
- seletionStyle: selected,
- unseletionStyle: .surface,
- style: style))
+ return environment(
+ \.segmentedControlStyle,
+ AnySegmentedControlStyle(
+ isEquallySpacing: false,
+ isShowBackground: false,
+ seletionStyle: selected,
+ unseletionStyle: .surface,
+ style: style
+ )
+ )
}
}
}
@@ -187,7 +215,7 @@ public struct IslandSegmentedControlStyle: SegmentedControlStyle {
// MARK: - Support
-public protocol SegmentedControlStyle {
+public protocol SegmentedControlStyle: Sendable {
associatedtype Body: View
typealias Configuration = SegmentedControlConfiguration
@@ -199,7 +227,7 @@ public protocol SegmentedControlStyle {
func makeBody(configuration: Self.Configuration) -> Self.Body
}
-public struct SegmentedControlConfiguration {
+public struct SegmentedControlConfiguration: Sendable {
public struct Label: View {
public init(content: some View) {
body = AnyView(content)
@@ -211,7 +239,7 @@ public struct SegmentedControlConfiguration {
public let label: SegmentedControlConfiguration.Label
}
-public struct AnySegmentedControlStyle: SegmentedControlStyle {
+public struct AnySegmentedControlStyle: SegmentedControlStyle, Sendable {
public var isEquallySpacing: Bool
public var isShowBackground: Bool
@@ -220,7 +248,7 @@ public struct AnySegmentedControlStyle: SegmentedControlStyle {
public var unseletionStyle: SegmentedControlUnseletionStyle
- private var _makeBody: (Configuration) -> AnyView
+ private var _makeBody: @Sendable (Configuration) -> AnyView
public init(isEquallySpacing: Bool,
isShowBackground: Bool,
@@ -243,11 +271,13 @@ public struct AnySegmentedControlStyle: SegmentedControlStyle {
}
public struct SegmentedControlKey: EnvironmentKey {
- public static var defaultValue = AnySegmentedControlStyle(isEquallySpacing: true,
- isShowBackground: true,
- seletionStyle: .shadowSurface,
- unseletionStyle: .clean,
- style: RectangleSegmentedControlStyle())
+ public static let defaultValue = AnySegmentedControlStyle(
+ isEquallySpacing: true,
+ isShowBackground: true,
+ seletionStyle: .shadowSurface,
+ unseletionStyle: .clean,
+ style: RectangleSegmentedControlStyle()
+ )
}
public extension EnvironmentValues {
@@ -259,11 +289,15 @@ public extension EnvironmentValues {
public extension View {
func segmentedControlStyle(_ style: some SegmentedControlStyle) -> some View {
- environment(\.segmentedControlStyle,
- AnySegmentedControlStyle(isEquallySpacing: style.isEquallySpacing,
- isShowBackground: style.isShowBackground,
- seletionStyle: style.seletionStyle,
- unseletionStyle: style.unseletionStyle,
- style: style))
+ environment(
+ \.segmentedControlStyle,
+ AnySegmentedControlStyle(
+ isEquallySpacing: style.isEquallySpacing,
+ isShowBackground: style.isShowBackground,
+ seletionStyle: style.seletionStyle,
+ unseletionStyle: style.unseletionStyle,
+ style: style
+ )
+ )
}
}
diff --git a/Sources/OversizeUI/Controls/SegmentedControl/Support/SegmentedControl+Extensions.swift b/Sources/OversizeUI/Controls/SegmentedControl/Support/SegmentedControl+Extensions.swift
index 286d5f5..5210817 100644
--- a/Sources/OversizeUI/Controls/SegmentedControl/Support/SegmentedControl+Extensions.swift
+++ b/Sources/OversizeUI/Controls/SegmentedControl/Support/SegmentedControl+Extensions.swift
@@ -21,7 +21,7 @@ extension View {
@ViewBuilder
@inlinable func alignmentGuide(_ alignment: HorizontalAlignment,
isActive: Bool,
- computeValue: @escaping (ViewDimensions) -> CGFloat) -> some View
+ computeValue: @Sendable @escaping (ViewDimensions) -> CGFloat) -> some View
{
if isActive {
alignmentGuide(alignment, computeValue: computeValue)
@@ -33,7 +33,7 @@ extension View {
@ViewBuilder
@inlinable func alignmentGuide(_ alignment: VerticalAlignment,
isActive: Bool,
- computeValue: @escaping (ViewDimensions) -> CGFloat) -> some View
+ computeValue: @Sendable @escaping (ViewDimensions) -> CGFloat) -> some View
{
if isActive {
alignmentGuide(alignment, computeValue: computeValue)
diff --git a/Sources/OversizeUI/Controls/SegmentedControl/Support/SegmentedControlPreview.swift b/Sources/OversizeUI/Controls/SegmentedControl/Support/SegmentedControlPreview.swift
index fbff8d0..2e65ac9 100644
--- a/Sources/OversizeUI/Controls/SegmentedControl/Support/SegmentedControlPreview.swift
+++ b/Sources/OversizeUI/Controls/SegmentedControl/Support/SegmentedControlPreview.swift
@@ -71,7 +71,7 @@ struct SegmentedControlPreview: View {
Text(item)
Text("Subtitle")
.subheadline()
- .onSurfaceMediumEmphasisForegroundColor()
+ .onSurfaceSecondaryForeground()
}
}
.segmentedControlStyle(SelectionOnlySegmentedControlStyle())
diff --git a/Sources/OversizeUI/Controls/Select/MultiSelect.swift b/Sources/OversizeUI/Controls/Select/MultiSelect.swift
index e9ae58f..a63fd76 100644
--- a/Sources/OversizeUI/Controls/Select/MultiSelect.swift
+++ b/Sources/OversizeUI/Controls/Select/MultiSelect.swift
@@ -6,6 +6,7 @@
import SwiftUI
// swiftlint:disable all
+@available(iOS 15.0, macOS 14, tvOS 15.0, watchOS 9.0, *)
public struct MultiSelect: View
where
Content: View,
@@ -62,7 +63,7 @@ public struct MultiSelect: View
where
Content: View,
@@ -62,7 +63,7 @@ public struct Select: View {
+ private let spacing: Space
+ private let content: Content
+
+ public init(spacing: Space = .zero, @ViewBuilder content: () -> Content) {
+ self.spacing = spacing
+ self.content = content()
+ }
+
+ public var body: some View {
+ VStack(alignment: .leading, spacing: spacing.rawValue) {
+ content
+ }
+ }
+}
+
+public struct TrailingVStack: View {
+ private let spacing: Space
+ private let content: Content
+
+ public init(spacing: Space = .zero, @ViewBuilder content: () -> Content) {
+ self.spacing = spacing
+ self.content = content()
+ }
+
+ public var body: some View {
+ VStack(alignment: .trailing, spacing: spacing.rawValue) {
+ content
+ }
+ }
+}
+
+public struct CenterVStack: View {
+ private let spacing: Space
+ private let content: Content
+
+ public init(spacing: Space = .zero, @ViewBuilder content: () -> Content) {
+ self.spacing = spacing
+ self.content = content()
+ }
+
+ public var body: some View {
+ VStack(alignment: .center, spacing: spacing.rawValue) {
+ content
+ }
+ }
+}
+
+public struct LeadingLazyVStack: View {
+ private let spacing: Space
+ private let content: Content
+
+ public init(spacing: Space = .zero, @ViewBuilder content: () -> Content) {
+ self.spacing = spacing
+ self.content = content()
+ }
+
+ public var body: some View {
+ LazyVStack(alignment: .leading, spacing: spacing.rawValue) {
+ content
+ }
+ }
+}
+
+public struct TrailingLazyVStack: View {
+ private let spacing: Space
+ private let content: Content
+
+ public init(spacing: Space = .zero, @ViewBuilder content: () -> Content) {
+ self.spacing = spacing
+ self.content = content()
+ }
+
+ public var body: some View {
+ LazyVStack(alignment: .trailing, spacing: spacing.rawValue) {
+ content
+ }
+ }
+}
+
+public struct CenterLazyVStack: View {
+ private let spacing: Space
+ private let content: Content
+
+ public init(spacing: Space = .zero, @ViewBuilder content: () -> Content) {
+ self.spacing = spacing
+ self.content = content()
+ }
+
+ public var body: some View {
+ LazyVStack(alignment: .center, spacing: spacing.rawValue) {
+ content
+ }
+ }
+}
diff --git a/Sources/OversizeUI/Controls/Surface/Surface.swift b/Sources/OversizeUI/Controls/Surface/Surface.swift
index cd13ba9..3b4982e 100644
--- a/Sources/OversizeUI/Controls/Surface/Surface.swift
+++ b/Sources/OversizeUI/Controls/Surface/Surface.swift
@@ -36,6 +36,8 @@ public struct Surface: View {
private let forceContentInsets: EdgeSpaceInsets?
private var isSurfaceClipped: Bool = false
+ @State var isHover = false
+
public init(
action: (() -> Void)? = nil,
@ViewBuilder label: () -> Label
@@ -58,8 +60,14 @@ public struct Surface: View {
action?()
} label: {
surface
+ .contentShape(Rectangle())
}
.buttonStyle(SurfaceButtonStyle())
+ #if os(macOS)
+ .onHover { hover in
+ isHover = hover
+ }
+ #endif
}
private var surface: some View {
@@ -68,14 +76,33 @@ public struct Surface: View {
.padding(.bottom, forceContentInsets?.bottom ?? contentInsets.bottom)
.padding(.leading, forceContentInsets?.leading ?? contentInsets.leading)
.padding(.trailing, forceContentInsets?.trailing ?? contentInsets.trailing)
- .background(
+ .background {
+ #if os(macOS)
+ ZStack {
+ RoundedRectangle(
+ cornerRadius: surfaceRadius,
+ style: .continuous
+ )
+ .fill(surfaceBackgroundColor)
+ .shadowElevaton(elevation)
+
+ if isHover {
+ RoundedRectangle(
+ cornerRadius: surfaceRadius,
+ style: .continuous
+ )
+ .fill(Color.onSurfaceTertiary.opacity(0.04))
+ }
+ }
+ #else
RoundedRectangle(
cornerRadius: surfaceRadius,
style: .continuous
)
.fill(surfaceBackgroundColor)
.shadowElevaton(elevation)
- )
+ #endif
+ }
.overlay(
RoundedRectangle(
cornerRadius: surfaceRadius,
@@ -171,7 +198,11 @@ public struct SurfaceButtonStyle: ButtonStyle {
public func makeBody(configuration: Self.Configuration) -> some View {
configuration.label
+ #if os(macOS)
+ .scaleEffect(configuration.isPressed ? 0.99 : 1)
+ #else
.scaleEffect(configuration.isPressed ? 0.96 : 1)
+ #endif
}
}
@@ -252,7 +283,7 @@ struct Surface_Previews: PreviewProvider {
static var previews: some View {
VStack {
Surface {
- RowDeprecated("Title") {}
+ Row("Title") {}
}
.surfaceStyle(.primary)
.previewLayout(.fixed(width: 414, height: 300))
@@ -260,7 +291,7 @@ struct Surface_Previews: PreviewProvider {
Surface {
Text("Text")
.title3()
- .onSurfaceHighEmphasisForegroundColor()
+ .onSurfacePrimaryForeground()
}
.surfaceStyle(.secondary)
.previewLayout(.fixed(width: 414, height: 200))
@@ -268,7 +299,7 @@ struct Surface_Previews: PreviewProvider {
Surface {
Text("Text")
.title3()
- .onSurfaceHighEmphasisForegroundColor()
+ .onSurfacePrimaryForeground()
}
.surfaceStyle(.primary)
.surfaceBorderColor(.surfaceSecondary)
diff --git a/Sources/OversizeUI/Controls/Switch/Switch.swift b/Sources/OversizeUI/Controls/Switch/Switch.swift
index dac048d..6bf280f 100644
--- a/Sources/OversizeUI/Controls/Switch/Switch.swift
+++ b/Sources/OversizeUI/Controls/Switch/Switch.swift
@@ -72,7 +72,7 @@ public struct Switch: View {
if let subtitle, !subtitle.isEmpty {
Text(subtitle)
.subheadline()
- .foregroundColor(.onSurfaceMediumEmphasis)
+ .foregroundColor(.onSurfaceSecondary)
}
}
.padding(contentInset)
@@ -88,9 +88,9 @@ public struct Switch: View {
private var foregroundColor: Color {
if isEnabled {
- Color.onSurfaceHighEmphasis
+ Color.onSurfacePrimary
} else {
- Color.onSurfaceDisabled
+ Color.onSurfaceTertiary
}
}
}
@@ -110,17 +110,19 @@ public extension Switch where Label == EmptyView {
}
}
-@available(iOS 14.0, *)
-struct Switch_LibraryContent: LibraryContentProvider {
- var views: [LibraryItem] {
- LibraryItem(
- Switch(isOn: .constant(false)) {
- Text("Text")
- },
- title: "Checkbox", category: .control
- )
- }
-}
+/*
+ @available(iOS 14.0, *)
+ struct Switch_LibraryContent: LibraryContentProvider {
+ var views: [LibraryItem] {
+ LibraryItem(
+ Switch(isOn: .constant(false)) {
+ Text("Text")
+ },
+ title: "Checkbox", category: .control
+ )
+ }
+ }
+ */
struct Switch_preview: PreviewProvider {
static var previews: some View {
diff --git a/Sources/OversizeUI/Controls/TextBox/TextBox.swift b/Sources/OversizeUI/Controls/TextBox/TextBox.swift
index 77c0fb7..9c9cb26 100644
--- a/Sources/OversizeUI/Controls/TextBox/TextBox.swift
+++ b/Sources/OversizeUI/Controls/TextBox/TextBox.swift
@@ -31,12 +31,14 @@ public struct TextBox: View {
public var body: some View {
VStack(alignment: textStackAlignment, spacing: textSpacing) {
- titleText
+ Text(title)
+ .font(titleFont)
+ .onSurfacePrimaryForeground()
- if let subtitle {
- Text(subtitle)
- .body(.medium)
- .foregroundColor(.onSurfaceMediumEmphasis)
+ subtitle.map {
+ Text($0)
+ .font(subtitleFont)
+ .onSurfaceSecondaryForeground()
}
}
.multilineTextAlignment(multilineTextAlignment)
@@ -68,21 +70,26 @@ public struct TextBox: View {
}
}
- private var titleText: some View {
- Group {
- switch size {
- case .small:
- Text(title)
- .headline(.semibold)
- case .medium:
- Text(title)
- .title2(true)
- case .large:
- Text(title)
- .title(true)
- }
+ private var titleFont: Font {
+ switch size {
+ case .small:
+ .headline.weight(.semibold)
+
+ case .medium:
+ .title2.weight(.bold)
+
+ case .large:
+ .title.weight(.semibold)
+ }
+ }
+
+ private var subtitleFont: Font {
+ switch size {
+ case .small:
+ .callout.weight(.regular)
+ default:
+ .body.weight(.medium)
}
- .onSurfaceHighEmphasisForegroundColor()
}
public func textBoxSize(_ size: TextBoxSize) -> TextBox {
diff --git a/Sources/OversizeUI/Controls/TextEditor/TextEditorPlaceholderViewModifier.swift b/Sources/OversizeUI/Controls/TextEditor/TextEditorPlaceholderViewModifier.swift
index 8a6f9f0..36df967 100644
--- a/Sources/OversizeUI/Controls/TextEditor/TextEditorPlaceholderViewModifier.swift
+++ b/Sources/OversizeUI/Controls/TextEditor/TextEditorPlaceholderViewModifier.swift
@@ -25,20 +25,18 @@ public struct TextEditorPlaceholderViewModifier: ViewModifier {
HStack {
Text(placeholder)
.subheadline(.medium)
- .foregroundColor(.onSurfaceHighEmphasis)
+ .foregroundColor(.onSurfacePrimary)
Spacer()
}
}
content
- .padding(.horizontal, .xSmall)
- .padding(.top, topInputPadding)
- .padding(.bottom, 10)
+ .padding(padding)
.headline(.medium)
- .onSurfaceHighEmphasisForegroundColor()
+ .onSurfacePrimaryForeground()
.background {
ZStack {
- RoundedRectangle(cornerRadius: .medium, style: .continuous)
+ RoundedRectangle(cornerRadius: fieldRadius, style: .continuous)
.fill(isFocused ? Color.surfacePrimary : Color.surfaceSecondary)
overlay
}
@@ -53,12 +51,66 @@ public struct TextEditorPlaceholderViewModifier: ViewModifier {
}
}
- var topInputPadding: CGFloat {
+ private var fieldRadius: Radius {
+ #if os(macOS)
+ return .xSmall
+ #else
+ return .medium
+ #endif
+ }
+
+ var padding: EdgeInsets {
+ switch fieldPlaceholderPosition {
+ case .default, .adjacent:
+ #if os(macOS)
+ return .init(
+ top: 10,
+ leading: Space.xSmall.rawValue,
+ bottom: 10,
+ trailing: Space.xSmall.rawValue
+ )
+ #else
+ return .init(
+ top: 10,
+ leading: Space.xSmall.rawValue,
+ bottom: 10,
+ trailing: Space.xSmall.rawValue
+ )
+ #endif
+ case .overInput:
+ #if os(macOS)
+ return .init(
+ top: text.isEmpty ? 13 : 22,
+ leading: Space.xxSmall.rawValue,
+ bottom: 10,
+ trailing: Space.xxSmall.rawValue
+ )
+ #else
+ return .init(
+ top: text.isEmpty ? 8 : 22,
+ leading: Space.xSmall.rawValue,
+ bottom: 10,
+ trailing: Space.xSmall.rawValue
+ )
+
+ #endif
+ }
+ }
+
+ var labelPadding: EdgeInsets {
switch fieldPlaceholderPosition {
case .default, .adjacent:
- 10
+ #if os(macOS)
+ return .init(Space.xSmall)
+ #else
+ return .init(Space.xSmall)
+ #endif
case .overInput:
- text.isEmpty ? 8 : 22
+ #if os(macOS)
+ return .init(horizontal: Space.xSmall, vertical: Space.xSmall)
+ #else
+ return .init(Space.xxSmall)
+ #endif
}
}
@@ -69,9 +121,9 @@ public struct TextEditorPlaceholderViewModifier: ViewModifier {
if text.isEmpty {
Text(placeholder)
.subheadline()
- .onSurfaceDisabledForegroundColor()
+ .onSurfaceTertiaryForeground()
.opacity(0.7)
- .padding(.small)
+ .padding(labelPadding)
}
case .adjacent:
EmptyView()
@@ -79,16 +131,16 @@ public struct TextEditorPlaceholderViewModifier: ViewModifier {
Text(placeholder)
.font(text.isEmpty ? .headline : .subheadline)
.fontWeight(text.isEmpty ? .medium : .semibold)
- .onSurfaceDisabledForegroundColor()
+ .onSurfaceTertiaryForeground()
.opacity(0.7)
- .padding(.small)
+ .padding(labelPadding)
.offset(y: text.isEmpty ? 0 : -6)
}
}
@ViewBuilder
var overlay: some View {
- RoundedRectangle(cornerRadius: Radius.medium, style: .continuous)
+ RoundedRectangle(cornerRadius: fieldRadius, style: .continuous)
.stroke(overlayBorderColor, lineWidth: isFocused ? 2 : CGFloat(theme.borderSize))
}
@@ -123,10 +175,12 @@ struct TextEditor_preview: PreviewProvider {
TextEditor(text: .constant(""))
.textEditorPlaceholder("Complaint", text: .constant(""))
.fieldLabelPosition(.overInput)
+ .fieldPosition(.top)
TextEditor(text: .constant("Text"))
.textEditorPlaceholder("Complaint", text: .constant("Text"))
.fieldLabelPosition(.overInput)
+ .fieldPosition(.bottom)
Spacer()
}
diff --git a/Sources/OversizeUI/Controls/TextField/FieldHelperViewModifier.swift b/Sources/OversizeUI/Controls/TextField/FieldHelperViewModifier.swift
index fa1edce..25d640f 100644
--- a/Sources/OversizeUI/Controls/TextField/FieldHelperViewModifier.swift
+++ b/Sources/OversizeUI/Controls/TextField/FieldHelperViewModifier.swift
@@ -23,13 +23,13 @@ public struct FieldHelperViewModifier: ViewModifier {
}
public func body(content: Content) -> some View {
- VStack(alignment: .leading, spacing: platform == .mac ? .xxxSmall : .xSmall) {
+ VStack(alignment: .leading, spacing: platform == .macOS ? .xxxSmall : .xSmall) {
content
if helperText.isEmpty == false, helperStyle != .none {
Text(helperText)
.subheadline(.medium)
.foregroundColor(helperForegroundColor)
- .offset(x: platform == .mac ? 4 : 0)
+ .offset(x: platform == .macOS ? 4 : 0)
}
}
.animation(.easeIn(duration: 0.15), value: helperStyle)
@@ -38,7 +38,7 @@ public struct FieldHelperViewModifier: ViewModifier {
private var helperForegroundColor: Color {
switch helperStyle {
case .helperText:
- Color.onSurfaceMediumEmphasis
+ Color.onSurfaceSecondary
case .errorText:
Color.error
case .sussesText:
diff --git a/Sources/OversizeUI/Controls/TextField/FieldTitleViewModifier.swift b/Sources/OversizeUI/Controls/TextField/FieldTitleViewModifier.swift
index 123fe08..f9323fd 100644
--- a/Sources/OversizeUI/Controls/TextField/FieldTitleViewModifier.swift
+++ b/Sources/OversizeUI/Controls/TextField/FieldTitleViewModifier.swift
@@ -16,7 +16,7 @@ public struct FieldTitleViewModifier: ViewModifier {
VStack(alignment: .leading, spacing: .xSmall) {
Text(title)
.subheadline(.medium)
- .onSurfaceHighEmphasisForegroundColor()
+ .onSurfacePrimaryForeground()
content
}
diff --git a/Sources/OversizeUI/Controls/TextField/LabeledTextFieldStyle.swift b/Sources/OversizeUI/Controls/TextField/LabeledTextFieldStyle.swift
index a88d016..09444cf 100644
--- a/Sources/OversizeUI/Controls/TextField/LabeledTextFieldStyle.swift
+++ b/Sources/OversizeUI/Controls/TextField/LabeledTextFieldStyle.swift
@@ -6,10 +6,11 @@
import SwiftUI
// swiftlint:disable identifier_name
+@available(iOS 15.0, macOS 14, tvOS 15.0, watchOS 9.0, *)
public struct LabeledTextFieldStyle: TextFieldStyle {
@Environment(\.theme) private var theme: ThemeSettings
@Environment(\.fieldLabelPosition) private var fieldPlaceholderPosition: FieldLabelPosition
- @Environment(\.fieldPosition) private var fieldPosition: FieldPosition
+ @Environment(\.fieldPosition) private var fieldPosition: VerticalAlignment?
@Environment(\.platform) private var platform: Platform
@FocusState private var isFocused: Bool
@Binding private var text: String
@@ -21,19 +22,19 @@ public struct LabeledTextFieldStyle: TextFieldStyle {
}
public func _body(configuration: TextField) -> some View {
- VStack(alignment: .leading, spacing: platform == .mac ? .xxxSmall : .xSmall) {
+ VStack(alignment: .leading, spacing: platform == .macOS ? .xxxSmall : .xSmall) {
if fieldPlaceholderPosition == .adjacent {
Text(placeholder)
.subheadline(.medium)
- .foregroundColor(platform == .mac ? .onSurfaceMediumEmphasis : .onSurfaceHighEmphasis)
+ .foregroundColor(platform == .macOS ? .onSurfaceSecondary : .onSurfacePrimary)
.frame(maxWidth: .infinity, alignment: .leading)
- .offset(x: platform == .mac ? 4 : 0)
+ .offset(x: platform == .macOS ? 4 : 0)
}
ZStack(alignment: .leading) {
labelTextView
configuration
.headline(.medium)
- .foregroundColor(.onSurfaceHighEmphasis)
+ .foregroundColor(.onSurfacePrimary)
.padding(padding)
.offset(y: fieldOffset)
.focused($isFocused)
@@ -62,7 +63,7 @@ public struct LabeledTextFieldStyle: TextFieldStyle {
#endif
case .overInput:
#if os(macOS)
- return .init(horizontal: .xxSmall, vertical: .xSmall)
+ return .init(.xSmall)
#else
return .init(
top: Space.xxxSmall.rawValue + Space.small.rawValue,
@@ -83,27 +84,28 @@ public struct LabeledTextFieldStyle: TextFieldStyle {
@ViewBuilder
private var fieldBackground: some View {
switch fieldPosition {
- case .default:
+ case .top, .bottom, .center:
#if canImport(UIKit)
- RoundedRectangle(
- cornerRadius: fieldRadius,
- style: .continuous
+ RoundedRectangleCorner(
+ radius: fieldRadius,
+ corners: backgroundShapeCorners
)
.fill(isFocused ? Color.surfacePrimary : Color.surfaceSecondary)
#else
if fieldPlaceholderPosition != .adjacent {
- RoundedRectangle(
- cornerRadius: fieldRadius,
- style: .continuous
+ RoundedRectangleCorner(
+ radius: fieldRadius,
+ corners: backgroundShapeCorners
)
.fill(isFocused ? Color.surfacePrimary : Color.surfaceSecondary)
}
#endif
- case .top, .bottom, .center:
+
+ default:
#if canImport(UIKit)
- RoundedRectangleCorner(
- radius: fieldRadius,
- corners: backgroundShapeCorners
+ RoundedRectangle(
+ cornerRadius: fieldRadius,
+ style: .continuous
)
.fill(isFocused ? Color.surfacePrimary : Color.surfaceSecondary)
#else
@@ -118,7 +120,7 @@ public struct LabeledTextFieldStyle: TextFieldStyle {
}
}
- var fieldRadius: Radius {
+ private var fieldRadius: Radius {
#if os(macOS)
return .xSmall
#else
@@ -129,14 +131,29 @@ public struct LabeledTextFieldStyle: TextFieldStyle {
#if canImport(UIKit)
private var backgroundShapeCorners: UIRectCorner {
switch fieldPosition {
- case .default:
+ case .top:
+ [.topLeft, .topRight]
+ case .bottom:
+ [.bottomLeft, .bottomRight]
+ case .center:
+ []
+ default:
[.allCorners]
+ }
+ }
+ #endif
+
+ #if canImport(AppKit)
+ private var backgroundShapeCorners: RectCorner {
+ switch fieldPosition {
case .top:
[.topLeft, .topRight]
case .bottom:
[.bottomLeft, .bottomRight]
case .center:
[]
+ default:
+ [.allCorners]
}
}
#endif
@@ -147,7 +164,7 @@ public struct LabeledTextFieldStyle: TextFieldStyle {
.zero
case .overInput:
#if os(macOS)
- text.isEmpty ? 0 : 8
+ text.isEmpty && !isFocused ? -2 : text.isEmpty ? 0 : isFocused ? 9 : 7
#else
text.isEmpty ? 0 : 10
#endif
@@ -157,23 +174,6 @@ public struct LabeledTextFieldStyle: TextFieldStyle {
@ViewBuilder
private var overlay: some View {
switch fieldPosition {
- case .default:
- #if canImport(UIKit)
- RoundedRectangle(
- cornerRadius: fieldRadius,
- style: .continuous
- )
- .stroke(overlayBorderColor, lineWidth: isFocused ? 2 : CGFloat(theme.borderSize))
- #else
- if fieldPlaceholderPosition != .adjacent {
- RoundedRectangle(
- cornerRadius: fieldRadius,
- style: .continuous
- )
- .stroke(overlayBorderColor, lineWidth: isFocused ? 2 : CGFloat(theme.borderSize))
- }
- #endif
-
case .top, .bottom, .center:
#if canImport(UIKit)
RoundedRectangleCorner(radius: fieldRadius, corners: backgroundShapeCorners)
@@ -181,6 +181,22 @@ public struct LabeledTextFieldStyle: TextFieldStyle {
overlayBorderColor,
lineWidth: isFocused ? 2 : CGFloat(theme.borderSize)
)
+ #elseif canImport(AppKit)
+ if fieldPlaceholderPosition != .adjacent {
+ RoundedRectangleCorner(radius: fieldRadius, corners: backgroundShapeCorners)
+ .stroke(
+ overlayBorderColor,
+ lineWidth: isFocused ? 2 : CGFloat(theme.borderSize)
+ )
+ }
+ #endif
+ default:
+ #if canImport(UIKit)
+ RoundedRectangle(
+ cornerRadius: fieldRadius,
+ style: .continuous
+ )
+ .stroke(overlayBorderColor, lineWidth: isFocused ? 2 : CGFloat(theme.borderSize))
#else
if fieldPlaceholderPosition != .adjacent {
RoundedRectangle(
@@ -200,7 +216,7 @@ public struct LabeledTextFieldStyle: TextFieldStyle {
if isFocused {
Text(placeholder)
.subheadline()
- .onSurfaceDisabledForegroundColor()
+ .onSurfaceTertiaryForeground()
.opacity(0.7)
#if os(macOS)
.padding(.xSmall)
@@ -214,7 +230,7 @@ public struct LabeledTextFieldStyle: TextFieldStyle {
Text(placeholder)
.font(text.isEmpty ? .headline : .subheadline)
.fontWeight(text.isEmpty ? .medium : .semibold)
- .onSurfaceDisabledForegroundColor()
+ .onSurfaceTertiaryForeground()
#if os(macOS)
.padding(.xSmall)
.offset(y: text.isEmpty ? 0 : -10)
@@ -237,6 +253,7 @@ public struct LabeledTextFieldStyle: TextFieldStyle {
}
}
+@available(iOS 15.0, macOS 14, tvOS 15.0, watchOS 9.0, *)
public extension TextFieldStyle where Self == LabeledTextFieldStyle {
static var `default`: LabeledTextFieldStyle {
LabeledTextFieldStyle(placeholder: "", text: .constant(""))
@@ -246,32 +263,3 @@ public extension TextFieldStyle where Self == LabeledTextFieldStyle {
LabeledTextFieldStyle(placeholder: placeholder, text: text)
}
}
-
-struct LabeledTextFieldStyle_Previews: PreviewProvider {
- static var previews: some View {
- VStack(spacing: 32) {
- TextField("Text", text: .constant("Placeholder"))
- .textFieldStyle(.default)
-
- TextField("Text", text: .constant("Placeholder"))
- .textFieldStyle(OverPlaceholderTextFieldStyle(placeholder: "Label"))
-
- TextField("Text", text: .constant("Placeholder"))
- .textFieldStyle(InsidePlaceholderTextFieldStyle(placeholder: "Label"))
-
- TextField("Text", text: .constant("Placeholder"))
- .textFieldStyle(DefaultPlaceholderTextFieldStyle())
- .fieldHelper(.constant("Help"), style: .constant(.helperText))
-
- TextField("Text", text: .constant("Placeholder"))
- .textFieldStyle(OverPlaceholderTextFieldStyle(placeholder: "Label"))
- .fieldHelper(.constant("Ok"), style: .constant(.sussesText))
-
- TextField("Text", text: .constant("Placeholder"))
- .textFieldStyle(InsidePlaceholderTextFieldStyle(placeholder: "Label"))
- .fieldHelper(.constant("Error"), style: .constant(.errorText))
-
- }.padding()
- .previewLayout(.sizeThatFits)
- }
-}
diff --git a/Sources/OversizeUI/Controls/TextField/TextFieldExtended.swift b/Sources/OversizeUI/Controls/TextField/TextFieldExtended.swift
index 152b1e3..e28dc21 100644
--- a/Sources/OversizeUI/Controls/TextField/TextFieldExtended.swift
+++ b/Sources/OversizeUI/Controls/TextField/TextFieldExtended.swift
@@ -62,7 +62,7 @@ public struct TextFieldExtended: View {
HStack {
Text(placeholder)
.subheadline()
- .foregroundColor(.onSurfaceHighEmphasis)
+ .foregroundColor(.onSurfacePrimary)
Spacer()
}
.padding(.bottom, Space.xxSmall)
@@ -81,7 +81,7 @@ public struct TextFieldExtended: View {
self.focused = focused
})
.headline()
- .foregroundColor(.onSurfaceHighEmphasis)
+ .foregroundColor(.onSurfacePrimary)
}
if trallingImage != .none {
@@ -116,7 +116,7 @@ public struct TextFieldExtended: View {
if helperStyle == .helperText {
Text(helperText)
.subheadline()
- .foregroundColor(.onSurfaceMediumEmphasis)
+ .foregroundColor(.onSurfaceSecondary)
} else if helperStyle == .errorText {
Text(helperText)
.subheadline()
diff --git a/Sources/OversizeUI/Controls/Toast/Snackbar.swift b/Sources/OversizeUI/Controls/Toast/Snackbar.swift
index ffa46d4..d4df23c 100644
--- a/Sources/OversizeUI/Controls/Toast/Snackbar.swift
+++ b/Sources/OversizeUI/Controls/Toast/Snackbar.swift
@@ -36,7 +36,7 @@ public struct Snackbar