├── .gitignore ├── PFCompArch.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── swiftpm │ │ └── Package.resolved └── xcuserdata │ └── sas.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── PFCompArch ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ └── LaunchScreen.storyboard ├── Common │ ├── CellView.swift │ └── Item.swift ├── ContentView.swift ├── IdentifiedTab │ └── IdentifiedView.swift ├── IndexedTab │ └── IndexedView.swift ├── Info.plist ├── ListTab │ ├── ListCell.swift │ └── ListView.swift ├── Preview Content │ └── Preview Assets.xcassets │ │ └── Contents.json └── SceneDelegate.swift ├── Readme.md └── images ├── img1.png └── img2.png /.gitignore: -------------------------------------------------------------------------------- 1 | xcuserdata/ 2 | -------------------------------------------------------------------------------- /PFCompArch.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 52; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 5A0AA2C923F6C2C7003627AE /* CompArch in Frameworks */ = {isa = PBXBuildFile; productRef = 5A0AA2C823F6C2C7003627AE /* CompArch */; }; 11 | 5A1EFD8623E87874003BAA72 /* IdentifiedView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A1EFD8523E87874003BAA72 /* IdentifiedView.swift */; }; 12 | 5A1EFD8923E87918003BAA72 /* IndexedView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A1EFD8823E87918003BAA72 /* IndexedView.swift */; }; 13 | 5A1EFD8C23E87AC0003BAA72 /* CellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A1EFD8B23E87AC0003BAA72 /* CellView.swift */; }; 14 | 5A1EFD8E23E880BF003BAA72 /* Item.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A1EFD8D23E880BF003BAA72 /* Item.swift */; }; 15 | 5A1EFD9123E88236003BAA72 /* ListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A1EFD9023E88236003BAA72 /* ListView.swift */; }; 16 | 5A24093523F8466400C4D850 /* ListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A24093423F8466400C4D850 /* ListCell.swift */; }; 17 | 5A410D7F2427B19D008C4A3C /* HistoryTransceiver in Frameworks */ = {isa = PBXBuildFile; productRef = 5A410D7E2427B19D008C4A3C /* HistoryTransceiver */; }; 18 | 5A4A375E23E9D86200795403 /* CasePaths in Frameworks */ = {isa = PBXBuildFile; productRef = 5A4A375D23E9D86200795403 /* CasePaths */; }; 19 | 5AF5F87423E400A50084E2D1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5AF5F87323E400A50084E2D1 /* AppDelegate.swift */; }; 20 | 5AF5F87623E400A50084E2D1 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5AF5F87523E400A50084E2D1 /* SceneDelegate.swift */; }; 21 | 5AF5F87823E400A50084E2D1 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5AF5F87723E400A50084E2D1 /* ContentView.swift */; }; 22 | 5AF5F87A23E400A80084E2D1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5AF5F87923E400A80084E2D1 /* Assets.xcassets */; }; 23 | 5AF5F87D23E400A80084E2D1 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5AF5F87C23E400A80084E2D1 /* Preview Assets.xcassets */; }; 24 | 5AF5F88023E400A80084E2D1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5AF5F87E23E400A80084E2D1 /* LaunchScreen.storyboard */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXCopyFilesBuildPhase section */ 28 | 5AF5F89823E401080084E2D1 /* Embed Frameworks */ = { 29 | isa = PBXCopyFilesBuildPhase; 30 | buildActionMask = 2147483647; 31 | dstPath = ""; 32 | dstSubfolderSpec = 10; 33 | files = ( 34 | ); 35 | name = "Embed Frameworks"; 36 | runOnlyForDeploymentPostprocessing = 0; 37 | }; 38 | /* End PBXCopyFilesBuildPhase section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | 5A1EFD8523E87874003BAA72 /* IdentifiedView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IdentifiedView.swift; sourceTree = ""; }; 42 | 5A1EFD8823E87918003BAA72 /* IndexedView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IndexedView.swift; sourceTree = ""; }; 43 | 5A1EFD8B23E87AC0003BAA72 /* CellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CellView.swift; sourceTree = ""; }; 44 | 5A1EFD8D23E880BF003BAA72 /* Item.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Item.swift; sourceTree = ""; }; 45 | 5A1EFD9023E88236003BAA72 /* ListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListView.swift; sourceTree = ""; }; 46 | 5A24093423F8466400C4D850 /* ListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListCell.swift; sourceTree = ""; }; 47 | 5AF5F87023E400A50084E2D1 /* PFCompArch.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PFCompArch.app; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | 5AF5F87323E400A50084E2D1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 49 | 5AF5F87523E400A50084E2D1 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 50 | 5AF5F87723E400A50084E2D1 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 51 | 5AF5F87923E400A80084E2D1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 52 | 5AF5F87C23E400A80084E2D1 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 53 | 5AF5F87F23E400A80084E2D1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 54 | 5AF5F88123E400A80084E2D1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55 | /* End PBXFileReference section */ 56 | 57 | /* Begin PBXFrameworksBuildPhase section */ 58 | 5AF5F86D23E400A50084E2D1 /* Frameworks */ = { 59 | isa = PBXFrameworksBuildPhase; 60 | buildActionMask = 2147483647; 61 | files = ( 62 | 5A410D7F2427B19D008C4A3C /* HistoryTransceiver in Frameworks */, 63 | 5A4A375E23E9D86200795403 /* CasePaths in Frameworks */, 64 | 5A0AA2C923F6C2C7003627AE /* CompArch in Frameworks */, 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | /* End PBXFrameworksBuildPhase section */ 69 | 70 | /* Begin PBXGroup section */ 71 | 5A1EFD8423E87780003BAA72 /* IndexedTab */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 5A1EFD8823E87918003BAA72 /* IndexedView.swift */, 75 | ); 76 | path = IndexedTab; 77 | sourceTree = ""; 78 | }; 79 | 5A1EFD8723E878FF003BAA72 /* IdentifiedTab */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 5A1EFD8523E87874003BAA72 /* IdentifiedView.swift */, 83 | ); 84 | path = IdentifiedTab; 85 | sourceTree = ""; 86 | }; 87 | 5A1EFD8A23E87AA5003BAA72 /* Common */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | 5A1EFD8B23E87AC0003BAA72 /* CellView.swift */, 91 | 5A1EFD8D23E880BF003BAA72 /* Item.swift */, 92 | ); 93 | path = Common; 94 | sourceTree = ""; 95 | }; 96 | 5A1EFD8F23E8821D003BAA72 /* ListTab */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 5A24093423F8466400C4D850 /* ListCell.swift */, 100 | 5A1EFD9023E88236003BAA72 /* ListView.swift */, 101 | ); 102 | path = ListTab; 103 | sourceTree = ""; 104 | }; 105 | 5A4A376123E9DDDD00795403 /* Frameworks */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | ); 109 | name = Frameworks; 110 | sourceTree = ""; 111 | }; 112 | 5AF5F86723E400A50084E2D1 = { 113 | isa = PBXGroup; 114 | children = ( 115 | 5AF5F87223E400A50084E2D1 /* PFCompArch */, 116 | 5AF5F87123E400A50084E2D1 /* Products */, 117 | 5A4A376123E9DDDD00795403 /* Frameworks */, 118 | ); 119 | sourceTree = ""; 120 | }; 121 | 5AF5F87123E400A50084E2D1 /* Products */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 5AF5F87023E400A50084E2D1 /* PFCompArch.app */, 125 | ); 126 | name = Products; 127 | sourceTree = ""; 128 | }; 129 | 5AF5F87223E400A50084E2D1 /* PFCompArch */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 5A1EFD8A23E87AA5003BAA72 /* Common */, 133 | 5A1EFD8723E878FF003BAA72 /* IdentifiedTab */, 134 | 5A1EFD8423E87780003BAA72 /* IndexedTab */, 135 | 5A1EFD8F23E8821D003BAA72 /* ListTab */, 136 | 5AF5F87323E400A50084E2D1 /* AppDelegate.swift */, 137 | 5AF5F87523E400A50084E2D1 /* SceneDelegate.swift */, 138 | 5AF5F87723E400A50084E2D1 /* ContentView.swift */, 139 | 5AF5F87923E400A80084E2D1 /* Assets.xcassets */, 140 | 5AF5F87E23E400A80084E2D1 /* LaunchScreen.storyboard */, 141 | 5AF5F88123E400A80084E2D1 /* Info.plist */, 142 | 5AF5F87B23E400A80084E2D1 /* Preview Content */, 143 | ); 144 | path = PFCompArch; 145 | sourceTree = ""; 146 | }; 147 | 5AF5F87B23E400A80084E2D1 /* Preview Content */ = { 148 | isa = PBXGroup; 149 | children = ( 150 | 5AF5F87C23E400A80084E2D1 /* Preview Assets.xcassets */, 151 | ); 152 | path = "Preview Content"; 153 | sourceTree = ""; 154 | }; 155 | /* End PBXGroup section */ 156 | 157 | /* Begin PBXNativeTarget section */ 158 | 5AF5F86F23E400A50084E2D1 /* PFCompArch */ = { 159 | isa = PBXNativeTarget; 160 | buildConfigurationList = 5AF5F88423E400A80084E2D1 /* Build configuration list for PBXNativeTarget "PFCompArch" */; 161 | buildPhases = ( 162 | 5AF5F86C23E400A50084E2D1 /* Sources */, 163 | 5AF5F86D23E400A50084E2D1 /* Frameworks */, 164 | 5AF5F86E23E400A50084E2D1 /* Resources */, 165 | 5AF5F89823E401080084E2D1 /* Embed Frameworks */, 166 | ); 167 | buildRules = ( 168 | ); 169 | dependencies = ( 170 | ); 171 | name = PFCompArch; 172 | packageProductDependencies = ( 173 | 5A4A375D23E9D86200795403 /* CasePaths */, 174 | 5A0AA2C823F6C2C7003627AE /* CompArch */, 175 | 5A410D7E2427B19D008C4A3C /* HistoryTransceiver */, 176 | ); 177 | productName = PFCompArch; 178 | productReference = 5AF5F87023E400A50084E2D1 /* PFCompArch.app */; 179 | productType = "com.apple.product-type.application"; 180 | }; 181 | /* End PBXNativeTarget section */ 182 | 183 | /* Begin PBXProject section */ 184 | 5AF5F86823E400A50084E2D1 /* Project object */ = { 185 | isa = PBXProject; 186 | attributes = { 187 | LastSwiftUpdateCheck = 1130; 188 | LastUpgradeCheck = 1130; 189 | ORGANIZATIONNAME = finestructure; 190 | TargetAttributes = { 191 | 5AF5F86F23E400A50084E2D1 = { 192 | CreatedOnToolsVersion = 11.3.1; 193 | }; 194 | }; 195 | }; 196 | buildConfigurationList = 5AF5F86B23E400A50084E2D1 /* Build configuration list for PBXProject "PFCompArch" */; 197 | compatibilityVersion = "Xcode 9.3"; 198 | developmentRegion = en; 199 | hasScannedForEncodings = 0; 200 | knownRegions = ( 201 | en, 202 | Base, 203 | ); 204 | mainGroup = 5AF5F86723E400A50084E2D1; 205 | packageReferences = ( 206 | 5A4A375C23E9D86200795403 /* XCRemoteSwiftPackageReference "swift-case-paths" */, 207 | 5A0AA2C723F6C2C7003627AE /* XCRemoteSwiftPackageReference "CompArch" */, 208 | 5A410D7D2427B19D008C4A3C /* XCRemoteSwiftPackageReference "HistoryTransceiver" */, 209 | ); 210 | productRefGroup = 5AF5F87123E400A50084E2D1 /* Products */; 211 | projectDirPath = ""; 212 | projectRoot = ""; 213 | targets = ( 214 | 5AF5F86F23E400A50084E2D1 /* PFCompArch */, 215 | ); 216 | }; 217 | /* End PBXProject section */ 218 | 219 | /* Begin PBXResourcesBuildPhase section */ 220 | 5AF5F86E23E400A50084E2D1 /* Resources */ = { 221 | isa = PBXResourcesBuildPhase; 222 | buildActionMask = 2147483647; 223 | files = ( 224 | 5AF5F88023E400A80084E2D1 /* LaunchScreen.storyboard in Resources */, 225 | 5AF5F87D23E400A80084E2D1 /* Preview Assets.xcassets in Resources */, 226 | 5AF5F87A23E400A80084E2D1 /* Assets.xcassets in Resources */, 227 | ); 228 | runOnlyForDeploymentPostprocessing = 0; 229 | }; 230 | /* End PBXResourcesBuildPhase section */ 231 | 232 | /* Begin PBXSourcesBuildPhase section */ 233 | 5AF5F86C23E400A50084E2D1 /* Sources */ = { 234 | isa = PBXSourcesBuildPhase; 235 | buildActionMask = 2147483647; 236 | files = ( 237 | 5A1EFD9123E88236003BAA72 /* ListView.swift in Sources */, 238 | 5AF5F87423E400A50084E2D1 /* AppDelegate.swift in Sources */, 239 | 5AF5F87623E400A50084E2D1 /* SceneDelegate.swift in Sources */, 240 | 5A1EFD8C23E87AC0003BAA72 /* CellView.swift in Sources */, 241 | 5AF5F87823E400A50084E2D1 /* ContentView.swift in Sources */, 242 | 5A1EFD8E23E880BF003BAA72 /* Item.swift in Sources */, 243 | 5A24093523F8466400C4D850 /* ListCell.swift in Sources */, 244 | 5A1EFD8923E87918003BAA72 /* IndexedView.swift in Sources */, 245 | 5A1EFD8623E87874003BAA72 /* IdentifiedView.swift in Sources */, 246 | ); 247 | runOnlyForDeploymentPostprocessing = 0; 248 | }; 249 | /* End PBXSourcesBuildPhase section */ 250 | 251 | /* Begin PBXVariantGroup section */ 252 | 5AF5F87E23E400A80084E2D1 /* LaunchScreen.storyboard */ = { 253 | isa = PBXVariantGroup; 254 | children = ( 255 | 5AF5F87F23E400A80084E2D1 /* Base */, 256 | ); 257 | name = LaunchScreen.storyboard; 258 | sourceTree = ""; 259 | }; 260 | /* End PBXVariantGroup section */ 261 | 262 | /* Begin XCBuildConfiguration section */ 263 | 5AF5F88223E400A80084E2D1 /* Debug */ = { 264 | isa = XCBuildConfiguration; 265 | buildSettings = { 266 | ALWAYS_SEARCH_USER_PATHS = NO; 267 | CLANG_ANALYZER_NONNULL = YES; 268 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 269 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 270 | CLANG_CXX_LIBRARY = "libc++"; 271 | CLANG_ENABLE_MODULES = YES; 272 | CLANG_ENABLE_OBJC_ARC = YES; 273 | CLANG_ENABLE_OBJC_WEAK = YES; 274 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 275 | CLANG_WARN_BOOL_CONVERSION = YES; 276 | CLANG_WARN_COMMA = YES; 277 | CLANG_WARN_CONSTANT_CONVERSION = YES; 278 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 279 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 280 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 281 | CLANG_WARN_EMPTY_BODY = YES; 282 | CLANG_WARN_ENUM_CONVERSION = YES; 283 | CLANG_WARN_INFINITE_RECURSION = YES; 284 | CLANG_WARN_INT_CONVERSION = YES; 285 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 286 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 287 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 288 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 289 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 290 | CLANG_WARN_STRICT_PROTOTYPES = YES; 291 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 292 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 293 | CLANG_WARN_UNREACHABLE_CODE = YES; 294 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 295 | COPY_PHASE_STRIP = NO; 296 | DEBUG_INFORMATION_FORMAT = dwarf; 297 | ENABLE_STRICT_OBJC_MSGSEND = YES; 298 | ENABLE_TESTABILITY = YES; 299 | GCC_C_LANGUAGE_STANDARD = gnu11; 300 | GCC_DYNAMIC_NO_PIC = NO; 301 | GCC_NO_COMMON_BLOCKS = YES; 302 | GCC_OPTIMIZATION_LEVEL = 0; 303 | GCC_PREPROCESSOR_DEFINITIONS = ( 304 | "DEBUG=1", 305 | "$(inherited)", 306 | ); 307 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 308 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 309 | GCC_WARN_UNDECLARED_SELECTOR = YES; 310 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 311 | GCC_WARN_UNUSED_FUNCTION = YES; 312 | GCC_WARN_UNUSED_VARIABLE = YES; 313 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 314 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 315 | MTL_FAST_MATH = YES; 316 | ONLY_ACTIVE_ARCH = YES; 317 | SDKROOT = iphoneos; 318 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 319 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 320 | }; 321 | name = Debug; 322 | }; 323 | 5AF5F88323E400A80084E2D1 /* Release */ = { 324 | isa = XCBuildConfiguration; 325 | buildSettings = { 326 | ALWAYS_SEARCH_USER_PATHS = NO; 327 | CLANG_ANALYZER_NONNULL = YES; 328 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 329 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 330 | CLANG_CXX_LIBRARY = "libc++"; 331 | CLANG_ENABLE_MODULES = YES; 332 | CLANG_ENABLE_OBJC_ARC = YES; 333 | CLANG_ENABLE_OBJC_WEAK = YES; 334 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 335 | CLANG_WARN_BOOL_CONVERSION = YES; 336 | CLANG_WARN_COMMA = YES; 337 | CLANG_WARN_CONSTANT_CONVERSION = YES; 338 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 339 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 340 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 341 | CLANG_WARN_EMPTY_BODY = YES; 342 | CLANG_WARN_ENUM_CONVERSION = YES; 343 | CLANG_WARN_INFINITE_RECURSION = YES; 344 | CLANG_WARN_INT_CONVERSION = YES; 345 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 346 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 347 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 348 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 349 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 350 | CLANG_WARN_STRICT_PROTOTYPES = YES; 351 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 352 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 353 | CLANG_WARN_UNREACHABLE_CODE = YES; 354 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 355 | COPY_PHASE_STRIP = NO; 356 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 357 | ENABLE_NS_ASSERTIONS = NO; 358 | ENABLE_STRICT_OBJC_MSGSEND = YES; 359 | GCC_C_LANGUAGE_STANDARD = gnu11; 360 | GCC_NO_COMMON_BLOCKS = YES; 361 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 362 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 363 | GCC_WARN_UNDECLARED_SELECTOR = YES; 364 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 365 | GCC_WARN_UNUSED_FUNCTION = YES; 366 | GCC_WARN_UNUSED_VARIABLE = YES; 367 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 368 | MTL_ENABLE_DEBUG_INFO = NO; 369 | MTL_FAST_MATH = YES; 370 | SDKROOT = iphoneos; 371 | SWIFT_COMPILATION_MODE = wholemodule; 372 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 373 | VALIDATE_PRODUCT = YES; 374 | }; 375 | name = Release; 376 | }; 377 | 5AF5F88523E400A80084E2D1 /* Debug */ = { 378 | isa = XCBuildConfiguration; 379 | buildSettings = { 380 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 381 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 382 | CODE_SIGN_STYLE = Automatic; 383 | DEVELOPMENT_ASSET_PATHS = "\"PFCompArch/Preview Content\""; 384 | DEVELOPMENT_TEAM = A42K5AU657; 385 | ENABLE_PREVIEWS = YES; 386 | INFOPLIST_FILE = PFCompArch/Info.plist; 387 | LD_RUNPATH_SEARCH_PATHS = ( 388 | "$(inherited)", 389 | "@executable_path/Frameworks", 390 | ); 391 | PRODUCT_BUNDLE_IDENTIFIER = co.finestructure.PFCompArch; 392 | PRODUCT_NAME = "$(TARGET_NAME)"; 393 | SWIFT_VERSION = 5.0; 394 | TARGETED_DEVICE_FAMILY = "1,2"; 395 | }; 396 | name = Debug; 397 | }; 398 | 5AF5F88623E400A80084E2D1 /* Release */ = { 399 | isa = XCBuildConfiguration; 400 | buildSettings = { 401 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 402 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 403 | CODE_SIGN_STYLE = Automatic; 404 | DEVELOPMENT_ASSET_PATHS = "\"PFCompArch/Preview Content\""; 405 | DEVELOPMENT_TEAM = A42K5AU657; 406 | ENABLE_PREVIEWS = YES; 407 | INFOPLIST_FILE = PFCompArch/Info.plist; 408 | LD_RUNPATH_SEARCH_PATHS = ( 409 | "$(inherited)", 410 | "@executable_path/Frameworks", 411 | ); 412 | PRODUCT_BUNDLE_IDENTIFIER = co.finestructure.PFCompArch; 413 | PRODUCT_NAME = "$(TARGET_NAME)"; 414 | SWIFT_VERSION = 5.0; 415 | TARGETED_DEVICE_FAMILY = "1,2"; 416 | }; 417 | name = Release; 418 | }; 419 | /* End XCBuildConfiguration section */ 420 | 421 | /* Begin XCConfigurationList section */ 422 | 5AF5F86B23E400A50084E2D1 /* Build configuration list for PBXProject "PFCompArch" */ = { 423 | isa = XCConfigurationList; 424 | buildConfigurations = ( 425 | 5AF5F88223E400A80084E2D1 /* Debug */, 426 | 5AF5F88323E400A80084E2D1 /* Release */, 427 | ); 428 | defaultConfigurationIsVisible = 0; 429 | defaultConfigurationName = Release; 430 | }; 431 | 5AF5F88423E400A80084E2D1 /* Build configuration list for PBXNativeTarget "PFCompArch" */ = { 432 | isa = XCConfigurationList; 433 | buildConfigurations = ( 434 | 5AF5F88523E400A80084E2D1 /* Debug */, 435 | 5AF5F88623E400A80084E2D1 /* Release */, 436 | ); 437 | defaultConfigurationIsVisible = 0; 438 | defaultConfigurationName = Release; 439 | }; 440 | /* End XCConfigurationList section */ 441 | 442 | /* Begin XCRemoteSwiftPackageReference section */ 443 | 5A0AA2C723F6C2C7003627AE /* XCRemoteSwiftPackageReference "CompArch" */ = { 444 | isa = XCRemoteSwiftPackageReference; 445 | repositoryURL = "git@github.com:finestructure/CompArch.git"; 446 | requirement = { 447 | kind = upToNextMajorVersion; 448 | minimumVersion = 0.1.0; 449 | }; 450 | }; 451 | 5A410D7D2427B19D008C4A3C /* XCRemoteSwiftPackageReference "HistoryTransceiver" */ = { 452 | isa = XCRemoteSwiftPackageReference; 453 | repositoryURL = "https://github.com/finestructure/HistoryTransceiver"; 454 | requirement = { 455 | kind = upToNextMajorVersion; 456 | minimumVersion = 0.0.8; 457 | }; 458 | }; 459 | 5A4A375C23E9D86200795403 /* XCRemoteSwiftPackageReference "swift-case-paths" */ = { 460 | isa = XCRemoteSwiftPackageReference; 461 | repositoryURL = "https://github.com/pointfreeco/swift-case-paths.git"; 462 | requirement = { 463 | kind = upToNextMajorVersion; 464 | minimumVersion = 0.1.0; 465 | }; 466 | }; 467 | /* End XCRemoteSwiftPackageReference section */ 468 | 469 | /* Begin XCSwiftPackageProductDependency section */ 470 | 5A0AA2C823F6C2C7003627AE /* CompArch */ = { 471 | isa = XCSwiftPackageProductDependency; 472 | package = 5A0AA2C723F6C2C7003627AE /* XCRemoteSwiftPackageReference "CompArch" */; 473 | productName = CompArch; 474 | }; 475 | 5A410D7E2427B19D008C4A3C /* HistoryTransceiver */ = { 476 | isa = XCSwiftPackageProductDependency; 477 | package = 5A410D7D2427B19D008C4A3C /* XCRemoteSwiftPackageReference "HistoryTransceiver" */; 478 | productName = HistoryTransceiver; 479 | }; 480 | 5A4A375D23E9D86200795403 /* CasePaths */ = { 481 | isa = XCSwiftPackageProductDependency; 482 | package = 5A4A375C23E9D86200795403 /* XCRemoteSwiftPackageReference "swift-case-paths" */; 483 | productName = CasePaths; 484 | }; 485 | /* End XCSwiftPackageProductDependency section */ 486 | }; 487 | rootObject = 5AF5F86823E400A50084E2D1 /* Project object */; 488 | } 489 | -------------------------------------------------------------------------------- /PFCompArch.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /PFCompArch.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /PFCompArch.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "object": { 3 | "pins": [ 4 | { 5 | "package": "CompArch", 6 | "repositoryURL": "git@github.com:finestructure/CompArch.git", 7 | "state": { 8 | "branch": null, 9 | "revision": "4df83f97f8650a57fc08d016a90081ee61874568", 10 | "version": "0.7.3" 11 | } 12 | }, 13 | { 14 | "package": "HistoryTransceiver", 15 | "repositoryURL": "https://github.com/finestructure/HistoryTransceiver", 16 | "state": { 17 | "branch": null, 18 | "revision": "7ea00f04e2b061d8fe65807611f63e07c25a0c0a", 19 | "version": "0.0.9" 20 | } 21 | }, 22 | { 23 | "package": "MultipeerKit", 24 | "repositoryURL": "https://github.com/insidegui/MultipeerKit", 25 | "state": { 26 | "branch": null, 27 | "revision": "3f430bc28e1426ba42cdaa8b19fb4d89ce6d1c3b", 28 | "version": "0.1.2" 29 | } 30 | }, 31 | { 32 | "package": "CasePaths", 33 | "repositoryURL": "https://github.com/pointfreeco/swift-case-paths.git", 34 | "state": { 35 | "branch": null, 36 | "revision": "a9c1e05518b6d95cf5844d823020376f2b6ff842", 37 | "version": "0.1.0" 38 | } 39 | } 40 | ] 41 | }, 42 | "version": 1 43 | } 44 | -------------------------------------------------------------------------------- /PFCompArch.xcodeproj/xcuserdata/sas.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | PFCompArch.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /PFCompArch/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // PFCompArch 4 | // 5 | // Created by Sven A. Schmidt on 31/01/2020. 6 | // Copyright © 2020 finestructure. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | // MARK: UISceneSession Lifecycle 22 | 23 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 24 | // Called when a new scene session is being created. 25 | // Use this method to select a configuration to create the new scene with. 26 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 27 | } 28 | 29 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 30 | // Called when the user discards a scene session. 31 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 32 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 33 | } 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /PFCompArch/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /PFCompArch/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /PFCompArch/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /PFCompArch/Common/CellView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CellView.swift 3 | // PFCompArch 4 | // 5 | // Created by Sven A. Schmidt on 03/02/2020. 6 | // Copyright © 2020 finestructure. All rights reserved. 7 | // 8 | 9 | import CompArch 10 | import SwiftUI 11 | 12 | 13 | extension CellView { 14 | struct State: Identifiable, Codable { 15 | var id: UUID { item.id } 16 | var item: Item 17 | } 18 | 19 | 20 | enum Action { 21 | case plusTapped 22 | case minusTapped 23 | } 24 | 25 | 26 | static var reducer: Reducer { 27 | return { state, action in 28 | switch action { 29 | case .plusTapped: 30 | state.item.value += 1 31 | return [] 32 | default: 33 | state.item.value -= 1 34 | return [] 35 | } 36 | } 37 | } 38 | } 39 | 40 | 41 | struct CellView: View { 42 | @ObservedObject var store: Store 43 | 44 | var body: some View { 45 | HStack { 46 | Button(action: { 47 | self.store.send(.minusTapped) 48 | }) { 49 | Image(systemName: "minus.circle.fill") 50 | } 51 | Text("\(store.value.item.value)").frame(width: 30) 52 | Button(action: { 53 | self.store.send(.plusTapped) 54 | }) { 55 | Image(systemName: "plus.circle.fill") 56 | } 57 | } 58 | } 59 | } 60 | 61 | 62 | struct CellView_Previews: PreviewProvider { 63 | static var previews: some View { 64 | CellView( 65 | store: .init(initialValue: .init(item: 3), 66 | reducer: CellView.reducer) 67 | ) 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /PFCompArch/Common/Item.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Item.swift 3 | // PFCompArch 4 | // 5 | // Created by Sven A. Schmidt on 03/02/2020. 6 | // Copyright © 2020 finestructure. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | struct Item: Identifiable, Codable { 13 | let id: UUID 14 | var value: Int 15 | } 16 | 17 | 18 | extension Item: ExpressibleByIntegerLiteral { 19 | init(integerLiteral value: Int) { 20 | self.id = UUID() 21 | self.value = value 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /PFCompArch/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // PFCompArch 4 | // 5 | // Created by Sven A. Schmidt on 31/01/2020. 6 | // Copyright © 2020 finestructure. All rights reserved. 7 | // 8 | 9 | import CasePaths 10 | import CompArch 11 | import HistoryTransceiver 12 | import SwiftUI 13 | 14 | 15 | extension ContentView { 16 | struct State: Codable { 17 | var identifiedView: IdentifiedView.State 18 | var indexedView: IndexedView.State 19 | var listView: ListView.State 20 | } 21 | 22 | enum Action { 23 | case identifiedView(IdentifiedView.Action) 24 | case indexedView(IndexedView.Action) 25 | case listView(ListView.Action) 26 | } 27 | 28 | static var reducer: Reducer { 29 | let identifiedViewReducer: Reducer = pullback( 30 | IdentifiedView.reducer, 31 | value: \State.identifiedView, 32 | action: /Action.identifiedView) 33 | 34 | let indexedViewReducer: Reducer = pullback( 35 | IndexedView.reducer, 36 | value: \State.indexedView, 37 | action: /Action.indexedView) 38 | 39 | let listViewReducer: Reducer = pullback( 40 | ListView.reducer, 41 | value: \State.listView, 42 | action: /Action.listView) 43 | 44 | return combine(identifiedViewReducer, indexedViewReducer, listViewReducer) 45 | } 46 | } 47 | 48 | 49 | struct ContentView: View { 50 | @ObservedObject var store: Store 51 | 52 | var body: some View { 53 | TabView { 54 | IdentifiedView(store: self.store.view(value: { $0.identifiedView }, 55 | action: { .identifiedView($0) }) 56 | ).tabItem { 57 | Image(systemName: "faceid") 58 | Text("Identified") 59 | } 60 | IndexedView(store: self.store.view(value: { $0.indexedView }, 61 | action: { .indexedView($0) }) 62 | ).tabItem { 63 | Image(systemName: "increase.indent") 64 | Text("Indexed") 65 | } 66 | ListView(store: self.store.view(value: { $0.listView }, 67 | action: { .listView($0) }) 68 | ).tabItem { 69 | Image(systemName: "list.dash") 70 | Text("List") 71 | } 72 | } 73 | } 74 | } 75 | 76 | 77 | extension ContentView { 78 | static func store(items: [Item]) -> Store { 79 | let initial = ContentView.State(identifiedView: .init(items: items), 80 | indexedView: .init(items: items), 81 | listView: .init(items: items)) 82 | return Store(initialValue: initial, reducer: reducer) 83 | } 84 | } 85 | 86 | 87 | struct ContentView_Previews: PreviewProvider { 88 | static var previews: some View { 89 | ContentView(store: ContentView.store(items: [1, 2, 3])) 90 | } 91 | } 92 | 93 | 94 | // MARK:- State surfing 95 | 96 | extension ContentView.State: StateInitializable { 97 | init() { 98 | let items: [Item] = [1, 2, 3] 99 | self.identifiedView = .init(items: items) 100 | self.indexedView = .init(items: items) 101 | self.listView = .init(items: items) 102 | } 103 | } 104 | 105 | 106 | extension ContentView: StateSurfable { 107 | static func body(store: Store) -> Self { 108 | ContentView(store: store) 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /PFCompArch/IdentifiedTab/IdentifiedView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IdentifiedView.swift 3 | // PFCompArch 4 | // 5 | // Created by Sven A. Schmidt on 03/02/2020. 6 | // Copyright © 2020 finestructure. All rights reserved. 7 | // 8 | 9 | import CasePaths 10 | import CompArch 11 | import SwiftUI 12 | 13 | 14 | typealias IdentifiedCell = Identified 15 | 16 | 17 | extension IdentifiedView { 18 | struct State: Codable { 19 | var items: [Item] 20 | func total() -> Int { items.reduce(0, { $0 + $1.value }) } 21 | var cells: [CellView.State] { 22 | get { items.map(CellView.State.init) } 23 | set { items = newValue.map { $0.item } } 24 | } 25 | } 26 | 27 | enum Action { 28 | case cell(IdentifiedCell) 29 | } 30 | 31 | static var reducer: Reducer { 32 | identified(reducer: CellView.reducer, \.cells, /Action.cell) 33 | } 34 | } 35 | 36 | 37 | struct IdentifiedView: View { 38 | @ObservedObject var store: Store 39 | 40 | var body: some View { 41 | VStack { 42 | Text("Identified").font(.title) 43 | Text("Total: \(store.value.total())") 44 | ForEach(store.value.cells) { cell in 45 | CellView(store: self.store.view(value: { $0.cells.first(where: { $0.id == cell.id })! }, 46 | action: { .cell(IdentifiedCell(id: cell.id, action: $0)) } 47 | ) 48 | )} 49 | } 50 | } 51 | } 52 | 53 | 54 | extension IdentifiedView { 55 | static func store(items: [Item]) -> Store { 56 | let initial = IdentifiedView.State(items: items) 57 | return Store(initialValue: initial, reducer: reducer) 58 | } 59 | } 60 | 61 | 62 | struct IdentifiedView_Previews: PreviewProvider { 63 | static var previews: some View { 64 | IdentifiedView(store: IdentifiedView.store(items: [1, 2, 3])) 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /PFCompArch/IndexedTab/IndexedView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IndexedView.swift 3 | // PFCompArch 4 | // 5 | // Created by Sven A. Schmidt on 03/02/2020. 6 | // Copyright © 2020 finestructure. All rights reserved. 7 | // 8 | 9 | import CasePaths 10 | import CompArch 11 | import SwiftUI 12 | 13 | 14 | extension IndexedView { 15 | struct State: Codable { 16 | var items: [Item] 17 | func total() -> Int { items.reduce(0, { $0 + $1.value }) } 18 | var cells: [CellView.State] { 19 | get { items.map(CellView.State.init) } 20 | set { items = newValue.map { $0.item } } 21 | } 22 | } 23 | 24 | enum Action { 25 | case cell(Indexed) 26 | } 27 | 28 | static var reducer: Reducer { 29 | indexed(reducer: CellView.reducer, \.cells, /Action.cell) 30 | } 31 | } 32 | 33 | 34 | struct IndexedView: View { 35 | @ObservedObject var store: Store 36 | 37 | var body: some View { 38 | VStack { 39 | Text("Indexed").font(.title) 40 | Text("Total: \(store.value.total())") 41 | ForEach(store.value.items.indices) { idx in 42 | CellView(store: 43 | self.store.view( 44 | value: { $0.cells[idx] }, 45 | action: { .cell(Indexed(index: idx, action: $0)) }) 46 | ) 47 | } 48 | } 49 | } 50 | } 51 | 52 | 53 | extension IndexedView { 54 | static func store(items: [Item]) -> Store { 55 | let initial = IndexedView.State(items: items) 56 | return Store(initialValue: initial, reducer: reducer) 57 | } 58 | } 59 | 60 | 61 | struct IndexedView_Previews: PreviewProvider { 62 | static var previews: some View { 63 | IndexedView(store: IndexedView.store(items: [2, 3, 4])) 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /PFCompArch/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | 37 | 38 | 39 | 40 | UILaunchStoryboardName 41 | LaunchScreen 42 | UIRequiredDeviceCapabilities 43 | 44 | armv7 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UISupportedInterfaceOrientations~ipad 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationPortraitUpsideDown 56 | UIInterfaceOrientationLandscapeLeft 57 | UIInterfaceOrientationLandscapeRight 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /PFCompArch/ListTab/ListCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ListCell.swift 3 | // PFCompArch 4 | // 5 | // Created by Sven A. Schmidt on 15/02/2020. 6 | // Copyright © 2020 finestructure. All rights reserved. 7 | // 8 | 9 | import CompArch 10 | import SwiftUI 11 | 12 | 13 | struct ListCell: View { 14 | @ObservedObject var store: Store 15 | 16 | var body: some View { 17 | HStack { 18 | VStack(alignment: .leading) { 19 | Text("\(store.value.id)") 20 | Text("\(store.value.item.value)") 21 | } 22 | Spacer() 23 | Image(systemName: "multiply.circle") 24 | .font(.title) 25 | .foregroundColor(Color.red) 26 | .onTapGesture { self.store.send(.deleteTapped) } 27 | } 28 | } 29 | 30 | struct State: Identifiable { 31 | var id: UUID { item.id } 32 | var item: Item 33 | } 34 | 35 | enum Action { 36 | case deleteTapped 37 | } 38 | 39 | static var reducer: Reducer = { state, action in 40 | switch action { 41 | case .deleteTapped: 42 | return [] 43 | } 44 | } 45 | } 46 | 47 | 48 | extension ListCell { 49 | static func store(item: Item) -> Store { 50 | let initial = ListCell.State(item: item) 51 | return Store(initialValue: initial, reducer: reducer) 52 | } 53 | } 54 | 55 | 56 | struct ListCell_Previews: PreviewProvider { 57 | static var previews: some View { 58 | ListCell(store: ListCell.store(item: 42)) 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /PFCompArch/ListTab/ListView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ListView.swift 3 | // PFCompArch 4 | // 5 | // Created by Sven A. Schmidt on 03/02/2020. 6 | // Copyright © 2020 finestructure. All rights reserved. 7 | // 8 | 9 | import CasePaths 10 | import CompArch 11 | import SwiftUI 12 | 13 | 14 | typealias IdentifiedListCell = Identified 15 | 16 | 17 | extension ListView { 18 | struct State: Codable { 19 | var items: [Item] 20 | var cells: [ListCell.State] { 21 | get { items.map(ListCell.State.init) } 22 | set { items = newValue.map { $0.item } } 23 | } 24 | } 25 | 26 | enum Action { 27 | case cell(IdentifiedListCell) 28 | case delete(IndexSet) 29 | } 30 | 31 | static var reducer: Reducer { 32 | let detailReducer: Reducer = identified(reducer: ListCell.reducer, \.cells, /Action.cell) 33 | let mainReducer: Reducer = { state, action in 34 | switch action { 35 | case .cell((let id, .deleteTapped)): 36 | state.items.removeAll(where: { $0.id == id }) 37 | return [] 38 | case .delete(let indexSet): 39 | indexSet.forEach { state.items.remove(at: $0) } 40 | return [] 41 | } 42 | } 43 | return combine(detailReducer, mainReducer) 44 | } 45 | } 46 | 47 | 48 | struct ListView: View { 49 | @ObservedObject var store: Store 50 | 51 | func cellView(for item: Item) -> AnyView { 52 | guard let cell = store.value.items.first(where: { $0.id == item.id }) else { 53 | return AnyView(EmptyView()) 54 | } 55 | return AnyView( 56 | ListCell(store: self.store.view( 57 | value: { _ in .init(item: cell) }, 58 | action: { .cell(IdentifiedListCell(id: cell.id, action: $0)) })) 59 | ) 60 | } 61 | 62 | var body: some View { 63 | List { 64 | ForEach(store.value.items) { cell in 65 | self.cellView(for: cell) 66 | } 67 | .onDelete { (indexSet) in 68 | self.store.send(.delete(indexSet)) 69 | } 70 | } 71 | } 72 | } 73 | 74 | 75 | extension ListView { 76 | static func store(items: [Item]) -> Store { 77 | let initial = ListView.State(items: items) 78 | return Store(initialValue: initial, reducer: reducer) 79 | } 80 | } 81 | 82 | 83 | struct ListView_Previews: PreviewProvider { 84 | static var previews: some View { 85 | ListView(store: ListView.store(items: [1, 2, 3])) 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /PFCompArch/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /PFCompArch/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // PFCompArch 4 | // 5 | // Created by Sven A. Schmidt on 31/01/2020. 6 | // Copyright © 2020 finestructure. All rights reserved. 7 | // 8 | 9 | import HistoryTransceiver 10 | import UIKit 11 | import SwiftUI 12 | 13 | 14 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 15 | 16 | var window: UIWindow? 17 | 18 | 19 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 20 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 21 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 22 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 23 | 24 | // Create the SwiftUI view that provides the window contents. 25 | let contentView = HistoryTransceiverView() 26 | contentView.resume() 27 | 28 | // Use a UIHostingController as window root view controller. 29 | if let windowScene = scene as? UIWindowScene { 30 | let window = UIWindow(windowScene: windowScene) 31 | window.rootViewController = UIHostingController(rootView: contentView) 32 | self.window = window 33 | window.makeKeyAndVisible() 34 | } 35 | } 36 | 37 | func sceneDidDisconnect(_ scene: UIScene) { 38 | // Called as the scene is being released by the system. 39 | // This occurs shortly after the scene enters the background, or when its session is discarded. 40 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 41 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 42 | } 43 | 44 | func sceneDidBecomeActive(_ scene: UIScene) { 45 | // Called when the scene has moved from an inactive state to an active state. 46 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 47 | } 48 | 49 | func sceneWillResignActive(_ scene: UIScene) { 50 | // Called when the scene will move from an active state to an inactive state. 51 | // This may occur due to temporary interruptions (ex. an incoming phone call). 52 | } 53 | 54 | func sceneWillEnterForeground(_ scene: UIScene) { 55 | // Called as the scene transitions from the background to the foreground. 56 | // Use this method to undo the changes made on entering the background. 57 | } 58 | 59 | func sceneDidEnterBackground(_ scene: UIScene) { 60 | // Called as the scene transitions from the foreground to the background. 61 | // Use this method to save data, release shared resources, and store enough scene-specific state information 62 | // to restore the scene back to its current state. 63 | } 64 | 65 | 66 | } 67 | 68 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # PFCompArch 2 | 3 | This is an example project for the "Composable Architecture" introduced by pointfree.co 4 | 5 | ![](/images/img1.png) 6 | ![](/images/img2.png) 7 | -------------------------------------------------------------------------------- /images/img1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/finestructure/PFCompArch/c8a0b225ecba9e39691fb8b370d455f19e77bee4/images/img1.png -------------------------------------------------------------------------------- /images/img2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/finestructure/PFCompArch/c8a0b225ecba9e39691fb8b370d455f19e77bee4/images/img2.png --------------------------------------------------------------------------------