diff --git a/Example/ListDetais/ListDetails.xcodeproj/project.pbxproj b/Example/ListDetais/ListDetails.xcodeproj/project.pbxproj new file mode 100644 index 0000000..94f1d9d --- /dev/null +++ b/Example/ListDetais/ListDetails.xcodeproj/project.pbxproj @@ -0,0 +1,357 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXBuildFile section */ + C3D9621A2D004F3F00EA2A69 /* SUINavigation in Frameworks */ = {isa = PBXBuildFile; productRef = C3D962192D004F3F00EA2A69 /* SUINavigation */; }; + C3D962372D005CC400EA2A69 /* SUINavigation in Frameworks */ = {isa = PBXBuildFile; productRef = C3D962362D005CC400EA2A69 /* SUINavigation */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + C3D962072D004D6E00EA2A69 /* ListDetails.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ListDetails.app; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + C3D962092D004D6E00EA2A69 /* ListDetails */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = ListDetails; + sourceTree = ""; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + C3D962042D004D6E00EA2A69 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + C3D962372D005CC400EA2A69 /* SUINavigation in Frameworks */, + C3D9621A2D004F3F00EA2A69 /* SUINavigation in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + C3D961FE2D004D6E00EA2A69 = { + isa = PBXGroup; + children = ( + C3D962092D004D6E00EA2A69 /* ListDetails */, + C3D962082D004D6E00EA2A69 /* Products */, + ); + sourceTree = ""; + }; + C3D962082D004D6E00EA2A69 /* Products */ = { + isa = PBXGroup; + children = ( + C3D962072D004D6E00EA2A69 /* ListDetails.app */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + C3D962062D004D6E00EA2A69 /* ListDetails */ = { + isa = PBXNativeTarget; + buildConfigurationList = C3D962152D004D6F00EA2A69 /* Build configuration list for PBXNativeTarget "ListDetails" */; + buildPhases = ( + C3D962032D004D6E00EA2A69 /* Sources */, + C3D962042D004D6E00EA2A69 /* Frameworks */, + C3D962052D004D6E00EA2A69 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + C3D962092D004D6E00EA2A69 /* ListDetails */, + ); + name = ListDetails; + packageProductDependencies = ( + C3D962192D004F3F00EA2A69 /* SUINavigation */, + C3D962362D005CC400EA2A69 /* SUINavigation */, + ); + productName = ListDetails; + productReference = C3D962072D004D6E00EA2A69 /* ListDetails.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + C3D961FF2D004D6E00EA2A69 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1610; + LastUpgradeCheck = 1610; + TargetAttributes = { + C3D962062D004D6E00EA2A69 = { + CreatedOnToolsVersion = 16.1; + }; + }; + }; + buildConfigurationList = C3D962022D004D6E00EA2A69 /* Build configuration list for PBXProject "ListDetails" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = C3D961FE2D004D6E00EA2A69; + minimizedProjectReferenceProxies = 1; + packageReferences = ( + C3D962352D005CC400EA2A69 /* XCLocalSwiftPackageReference "../../../SUINavigation" */, + ); + preferredProjectObjectVersion = 77; + productRefGroup = C3D962082D004D6E00EA2A69 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + C3D962062D004D6E00EA2A69 /* ListDetails */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + C3D962052D004D6E00EA2A69 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + C3D962032D004D6E00EA2A69 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + C3D962132D004D6F00EA2A69 /* Debug */ = { + 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++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.1; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + C3D962142D004D6F00EA2A69 /* Release */ = { + 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++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.1; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + C3D962162D004D6F00EA2A69 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"ListDetails/Preview Content\""; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = Ozon.ListDetails; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + C3D962172D004D6F00EA2A69 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"ListDetails/Preview Content\""; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = Ozon.ListDetails; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C3D962022D004D6E00EA2A69 /* Build configuration list for PBXProject "ListDetails" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C3D962132D004D6F00EA2A69 /* Debug */, + C3D962142D004D6F00EA2A69 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C3D962152D004D6F00EA2A69 /* Build configuration list for PBXNativeTarget "ListDetails" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C3D962162D004D6F00EA2A69 /* Debug */, + C3D962172D004D6F00EA2A69 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCLocalSwiftPackageReference section */ + C3D962352D005CC400EA2A69 /* XCLocalSwiftPackageReference "../../../SUINavigation" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = ../../../SUINavigation; + }; +/* End XCLocalSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + C3D962192D004F3F00EA2A69 /* SUINavigation */ = { + isa = XCSwiftPackageProductDependency; + productName = SUINavigation; + }; + C3D962362D005CC400EA2A69 /* SUINavigation */ = { + isa = XCSwiftPackageProductDependency; + productName = SUINavigation; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = C3D961FF2D004D6E00EA2A69 /* Project object */; +} diff --git a/Example/ListDetais/ListDetails.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Example/ListDetais/ListDetails.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Example/ListDetais/ListDetails.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Example/ListDetais/ListDetails/Assets.xcassets/AccentColor.colorset/Contents.json b/Example/ListDetais/ListDetails/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/Example/ListDetais/ListDetails/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/ListDetais/ListDetails/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/ListDetais/ListDetails/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..2305880 --- /dev/null +++ b/Example/ListDetais/ListDetails/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,35 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "tinted" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/ListDetais/ListDetails/Assets.xcassets/Contents.json b/Example/ListDetais/ListDetails/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Example/ListDetais/ListDetails/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/ListDetais/ListDetails/DetailsView.swift b/Example/ListDetais/ListDetails/DetailsView.swift new file mode 100644 index 0000000..3e9b4e0 --- /dev/null +++ b/Example/ListDetais/ListDetails/DetailsView.swift @@ -0,0 +1,18 @@ +// +// DetailsView.swift +// ListDetails +// +// Created by Sergey Balalaev on 04.12.2024. +// + +import SwiftUI + +struct DetailsView: View { + + var text: String + + var body: some View { + Text(text) + .navigationTitle("Details") + } +} diff --git a/Example/ListDetais/ListDetails/ListDetailsApp.swift b/Example/ListDetais/ListDetails/ListDetailsApp.swift new file mode 100644 index 0000000..699544b --- /dev/null +++ b/Example/ListDetais/ListDetails/ListDetailsApp.swift @@ -0,0 +1,20 @@ +// +// ListDetailsApp.swift +// ListDetails +// +// Created by Sergey Balalaev on 04.12.2024. +// + +import SwiftUI +import SUINavigation + +@main +struct ListDetailsApp: App { + var body: some Scene { + WindowGroup { + NavigationViewStorage { + ListView() + } + } + } +} diff --git a/Example/ListDetais/ListDetails/ListView.swift b/Example/ListDetais/ListDetails/ListView.swift new file mode 100644 index 0000000..dae9d89 --- /dev/null +++ b/Example/ListDetais/ListDetails/ListView.swift @@ -0,0 +1,65 @@ +// +// ListView.swift +// ListDetails +// +// Created by Sergey Balalaev on 04.12.2024. +// + +import SwiftUI + +/// Trigger between TrueListView and FalseListView solution to target +typealias ListView = TrueListView + +extension ListView { + static let elements: [String] = (1...100).map{ index in + "Element \(index)" + } +} + +/// Incorrect implementation of the list when navigation is focused on each list item +struct FalseListView: View { + + var array = ListView.elements + + @State + var isDetailsShow = false + + var body: some View { + List(array, id: \.self) { item in + Button { + isDetailsShow = true + } label: { + Text(item) + .navigation(isActive: $isDetailsShow) { + DetailsView(text: item) + } + } + } + .padding(0) + .navigationTitle("Elements") + } +} + +/// Сorrect implementation of the list when navigation is focused on the entire screen and not on its individual elements +struct TrueListView: View { + + var array = ListView.elements + + @State + var detailsItem: String? = nil + + var body: some View { + List(array, id: \.self) { item in + Button { + detailsItem = item + } label: { + Text(item) + } + } + .padding(0) + .navigationTitle("Elements") + .navigation(item: $detailsItem) { item in + DetailsView(text: item) + } + } +} diff --git a/Example/ListDetais/ListDetails/Preview Content/Preview Assets.xcassets/Contents.json b/Example/ListDetais/ListDetails/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Example/ListDetais/ListDetails/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +}