diff --git a/Cartfile b/Cartfile new file mode 100644 index 0000000..9b0c347 --- /dev/null +++ b/Cartfile @@ -0,0 +1 @@ +github "Dev1an/A-Star" ~> 3.0.0-beta-1 diff --git a/Cartfile.resolved b/Cartfile.resolved new file mode 100644 index 0000000..5e610f1 --- /dev/null +++ b/Cartfile.resolved @@ -0,0 +1 @@ +github "Dev1an/A-Star" "3.0.0-beta-1" diff --git a/DemoApp/AppDelegate.swift b/DemoApp/AppDelegate.swift index 5b63a08..5eb3449 100644 --- a/DemoApp/AppDelegate.swift +++ b/DemoApp/AppDelegate.swift @@ -10,7 +10,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. let splitViewController = window!.rootViewController as! UISplitViewController let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as! UINavigationController diff --git a/DemoApp/MasterViewController.swift b/DemoApp/MasterViewController.swift index c83d8b9..4ed2ea2 100644 --- a/DemoApp/MasterViewController.swift +++ b/DemoApp/MasterViewController.swift @@ -91,7 +91,7 @@ class MasterViewController: UITableViewController { return true } - override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) { + override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) { if editingStyle == .delete { objects.remove(at: indexPath.row) tableView.deleteRows(at: [indexPath], with: .fade) diff --git a/MappaMundi.xcodeproj/project.pbxproj b/MappaMundi.xcodeproj/project.pbxproj index d7971ca..4f8b8b3 100644 --- a/MappaMundi.xcodeproj/project.pbxproj +++ b/MappaMundi.xcodeproj/project.pbxproj @@ -7,18 +7,22 @@ objects = { /* Begin PBXBuildFile section */ - 392FB353200E1D5D0014867E /* MMTestUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 392FB352200E1D5D0014867E /* MMTestUtils.swift */; }; - 3962F2291FF6A6C100999008 /* Wait.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3962F2281FF6A6C100999008 /* Wait.swift */; }; - 3962F22B1FF6A75800999008 /* ScreenGraphEdge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3962F22A1FF6A75800999008 /* ScreenGraphEdge.swift */; }; - 39658ADC1FF699AA000544A2 /* MMScreenStateNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39658ADB1FF699AA000544A2 /* MMScreenStateNode.swift */; }; - 39658ADE1FF69BCE000544A2 /* MMNavigator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39658ADD1FF69BCE000544A2 /* MMNavigator.swift */; }; - 39658AE01FF69F62000544A2 /* MMScreenActionNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39658ADF1FF69F62000544A2 /* MMScreenActionNode.swift */; }; - 39658AE21FF6A065000544A2 /* MMUserState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39658AE11FF6A065000544A2 /* MMUserState.swift */; }; - 397334491FF6AAA600C45ECE /* MMGraphNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397334481FF6AAA600C45ECE /* MMGraphNode.swift */; }; - 39870718200D16710067B070 /* GraphRepresentation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39870717200D16710067B070 /* GraphRepresentation.swift */; }; + 1355A49C22C8A48C00EB635F /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1355A49B22C8A48C00EB635F /* XCTest.framework */; }; + 1355A49F22C8A53700EB635F /* MMNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13CE0A8222ABD42F005CA5E3 /* MMNode.swift */; }; + 1355A4A022C8A53700EB635F /* MMScreenGraph.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39AB5FDB1FE455C700008FB3 /* MMScreenGraph.swift */; }; + 1355A4A122C8A53700EB635F /* MMGraphNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397334481FF6AAA600C45ECE /* MMGraphNode.swift */; }; + 1355A4A222C8A53700EB635F /* MMTestUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 392FB352200E1D5D0014867E /* MMTestUtils.swift */; }; + 1355A4A322C8A53700EB635F /* MMScreenActionNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39658ADF1FF69F62000544A2 /* MMScreenActionNode.swift */; }; + 1355A4A422C8A53700EB635F /* MMScreenStateNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39658ADB1FF699AA000544A2 /* MMScreenStateNode.swift */; }; + 1355A4A522C8A53700EB635F /* MMNavigator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39658ADD1FF69BCE000544A2 /* MMNavigator.swift */; }; + 1355A4A622C8A53700EB635F /* MMUserState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39658AE11FF6A065000544A2 /* MMUserState.swift */; }; + 1355A4A722C8A53700EB635F /* GraphRepresentation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39870717200D16710067B070 /* GraphRepresentation.swift */; }; + 1355A4A822C8A53700EB635F /* ScreenGraphEdge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3962F22A1FF6A75800999008 /* ScreenGraphEdge.swift */; }; + 1355A4A922C8A53700EB635F /* Wait.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3962F2281FF6A6C100999008 /* Wait.swift */; }; + 1355A4AB22C8A59B00EB635F /* AStar.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1355A49722C8A2E100EB635F /* AStar.framework */; settings = {ATTRIBUTES = (Required, ); }; }; + 13E36CDB22C8DF9000AE04DB /* MappaMundi.h in Headers */ = {isa = PBXBuildFile; fileRef = 39AB5FE61FE4595000008FB3 /* MappaMundi.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 13E36D1522C8EAA600AE04DB /* AStar.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1355A49722C8A2E100EB635F /* AStar.framework */; }; 39AB5FDE1FE4560D00008FB3 /* DemoMappaMundi.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39AB5FDD1FE4560D00008FB3 /* DemoMappaMundi.swift */; }; - 39AB5FEC1FE4597800008FB3 /* MMScreenGraph.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39AB5FDB1FE455C700008FB3 /* MMScreenGraph.swift */; }; - 39AB5FF21FE45FF500008FB3 /* MappaMundi.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 39AB5FE41FE4595000008FB3 /* MappaMundi.framework */; }; 39BAD55F1FE19B9E00524FB7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39BAD55E1FE19B9E00524FB7 /* AppDelegate.swift */; }; 39BAD5611FE19B9E00524FB7 /* MasterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39BAD5601FE19B9E00524FB7 /* MasterViewController.swift */; }; 39BAD5631FE19B9E00524FB7 /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39BAD5621FE19B9E00524FB7 /* DetailViewController.swift */; }; @@ -29,6 +33,13 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 1355A47F22C8A25C00EB635F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 39BAD5531FE19B9D00524FB7 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 1355A47922C8A25C00EB635F; + remoteInfo = MappaMundi; + }; 39BAD5721FE19B9E00524FB7 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 39BAD5531FE19B9D00524FB7 /* Project object */; @@ -39,6 +50,15 @@ /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ + 13E36CBD22C8AC2500AE04DB /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; D8A18F461FE463C9009DA463 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -52,6 +72,14 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 1355A47122C89CD400EB635F /* Cartfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Cartfile; sourceTree = ""; }; + 1355A47222C89CD400EB635F /* Cartfile.resolved */ = {isa = PBXFileReference; lastKnownFileType = text; path = Cartfile.resolved; sourceTree = ""; }; + 1355A47A22C8A25C00EB635F /* MappaMundi.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MappaMundi.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 1355A47C22C8A25C00EB635F /* MappaMundi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MappaMundi.h; sourceTree = ""; }; + 1355A47D22C8A25C00EB635F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 1355A49722C8A2E100EB635F /* AStar.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AStar.framework; path = Carthage/Build/iOS/AStar.framework; sourceTree = ""; }; + 1355A49B22C8A48C00EB635F /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; + 13CE0A8222ABD42F005CA5E3 /* MMNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MMNode.swift; path = Sources/MMNode.swift; sourceTree = SOURCE_ROOT; }; 392FB352200E1D5D0014867E /* MMTestUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MMTestUtils.swift; sourceTree = ""; }; 3962F2281FF6A6C100999008 /* Wait.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Wait.swift; path = ../Sources/Wait.swift; sourceTree = ""; }; 3962F22A1FF6A75800999008 /* ScreenGraphEdge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ScreenGraphEdge.swift; path = ../Sources/ScreenGraphEdge.swift; sourceTree = ""; }; @@ -63,10 +91,8 @@ 39870717200D16710067B070 /* GraphRepresentation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GraphRepresentation.swift; path = Sources/GraphRepresentation.swift; sourceTree = SOURCE_ROOT; }; 39AB5FDB1FE455C700008FB3 /* MMScreenGraph.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MMScreenGraph.swift; path = ../Sources/MMScreenGraph.swift; sourceTree = ""; }; 39AB5FDD1FE4560D00008FB3 /* DemoMappaMundi.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoMappaMundi.swift; sourceTree = ""; }; - 39AB5FE41FE4595000008FB3 /* MappaMundi.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MappaMundi.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 39AB5FE61FE4595000008FB3 /* MappaMundi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MappaMundi.h; sourceTree = ""; }; 39AB5FE71FE4595000008FB3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 39AB5FEE1FE459AD00008FB3 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 39BAD55B1FE19B9D00524FB7 /* DemoApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DemoApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; 39BAD55E1FE19B9E00524FB7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 39BAD5601FE19B9E00524FB7 /* MasterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterViewController.swift; sourceTree = ""; }; @@ -81,10 +107,12 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 39AB5FE01FE4595000008FB3 /* Frameworks */ = { + 1355A47722C8A25C00EB635F /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 1355A49C22C8A48C00EB635F /* XCTest.framework in Frameworks */, + 1355A4AB22C8A59B00EB635F /* AStar.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -99,16 +127,26 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 39AB5FF21FE45FF500008FB3 /* MappaMundi.framework in Frameworks */, + 13E36D1522C8EAA600AE04DB /* AStar.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 1355A47B22C8A25C00EB635F /* MappaMundi */ = { + isa = PBXGroup; + children = ( + 1355A47C22C8A25C00EB635F /* MappaMundi.h */, + 1355A47D22C8A25C00EB635F /* Info.plist */, + ); + path = MappaMundi; + sourceTree = ""; + }; 39AB5FE51FE4595000008FB3 /* MappaMundi */ = { isa = PBXGroup; children = ( + 13CE0A8222ABD42F005CA5E3 /* MMNode.swift */, 39AB5FDB1FE455C700008FB3 /* MMScreenGraph.swift */, 397334481FF6AAA600C45ECE /* MMGraphNode.swift */, 392FB352200E1D5D0014867E /* MMTestUtils.swift */, @@ -128,7 +166,8 @@ 39AB5FED1FE459AD00008FB3 /* Frameworks */ = { isa = PBXGroup; children = ( - 39AB5FEE1FE459AD00008FB3 /* XCTest.framework */, + 1355A49B22C8A48C00EB635F /* XCTest.framework */, + 1355A49722C8A2E100EB635F /* AStar.framework */, ); name = Frameworks; sourceTree = ""; @@ -136,9 +175,12 @@ 39BAD5521FE19B9D00524FB7 = { isa = PBXGroup; children = ( + 1355A47122C89CD400EB635F /* Cartfile */, + 1355A47222C89CD400EB635F /* Cartfile.resolved */, 39BAD55D1FE19B9E00524FB7 /* DemoApp */, 39BAD5741FE19B9E00524FB7 /* UITests */, 39AB5FE51FE4595000008FB3 /* MappaMundi */, + 1355A47B22C8A25C00EB635F /* MappaMundi */, 39BAD55C1FE19B9D00524FB7 /* Products */, 39AB5FED1FE459AD00008FB3 /* Frameworks */, ); @@ -149,7 +191,7 @@ children = ( 39BAD55B1FE19B9D00524FB7 /* DemoApp.app */, 39BAD5711FE19B9E00524FB7 /* DemoUITests.xctest */, - 39AB5FE41FE4595000008FB3 /* MappaMundi.framework */, + 1355A47A22C8A25C00EB635F /* MappaMundi.framework */, ); name = Products; sourceTree = ""; @@ -181,25 +223,26 @@ /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ - 39AB5FE11FE4595000008FB3 /* Headers */ = { + 1355A47522C8A25C00EB635F /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + 13E36CDB22C8DF9000AE04DB /* MappaMundi.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 39AB5FE31FE4595000008FB3 /* MappaMundi */ = { + 1355A47922C8A25C00EB635F /* MappaMundi */ = { isa = PBXNativeTarget; - buildConfigurationList = 39AB5FE91FE4595000008FB3 /* Build configuration list for PBXNativeTarget "MappaMundi" */; + buildConfigurationList = 1355A48322C8A25C00EB635F /* Build configuration list for PBXNativeTarget "MappaMundi" */; buildPhases = ( - 39AB5FDF1FE4595000008FB3 /* Sources */, - 39AB5FE01FE4595000008FB3 /* Frameworks */, - 39AB5FE11FE4595000008FB3 /* Headers */, - 39AB5FE21FE4595000008FB3 /* Resources */, - D81FAF8B1FE46A1D00863A8A /* ShellScript */, + 1355A47522C8A25C00EB635F /* Headers */, + 1355A47622C8A25C00EB635F /* Sources */, + 1355A47722C8A25C00EB635F /* Frameworks */, + 1355A47822C8A25C00EB635F /* Resources */, + 13E36CBD22C8AC2500AE04DB /* CopyFiles */, ); buildRules = ( ); @@ -207,7 +250,7 @@ ); name = MappaMundi; productName = MappaMundi; - productReference = 39AB5FE41FE4595000008FB3 /* MappaMundi.framework */; + productReference = 1355A47A22C8A25C00EB635F /* MappaMundi.framework */; productType = "com.apple.product-type.framework"; }; 39BAD55A1FE19B9D00524FB7 /* DemoApp */ = { @@ -222,6 +265,7 @@ buildRules = ( ); dependencies = ( + 1355A48022C8A25C00EB635F /* PBXTargetDependency */, ); name = DemoApp; productName = Sample; @@ -235,6 +279,7 @@ 39BAD56D1FE19B9E00524FB7 /* Sources */, 39BAD56E1FE19B9E00524FB7 /* Frameworks */, 39BAD56F1FE19B9E00524FB7 /* Resources */, + 13E36D1422C8EA7600AE04DB /* Copy Carthage Frameworks */, ); buildRules = ( ); @@ -256,8 +301,8 @@ LastUpgradeCheck = 1020; ORGANIZATIONNAME = "Mozilla Corporation"; TargetAttributes = { - 39AB5FE31FE4595000008FB3 = { - CreatedOnToolsVersion = 9.2; + 1355A47922C8A25C00EB635F = { + CreatedOnToolsVersion = 10.2.1; ProvisioningStyle = Automatic; }; 39BAD55A1FE19B9D00524FB7 = { @@ -286,13 +331,13 @@ targets = ( 39BAD55A1FE19B9D00524FB7 /* DemoApp */, 39BAD5701FE19B9E00524FB7 /* DemoUITests */, - 39AB5FE31FE4595000008FB3 /* MappaMundi */, + 1355A47922C8A25C00EB635F /* MappaMundi */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - 39AB5FE21FE4595000008FB3 /* Resources */ = { + 1355A47822C8A25C00EB635F /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( @@ -319,36 +364,43 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - D81FAF8B1FE46A1D00863A8A /* ShellScript */ = { + 13E36D1422C8EA7600AE04DB /* Copy Carthage Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); + inputFileListPaths = ( + ); inputPaths = ( + "$(SRCROOT)/Carthage/Build/iOS/AStar.framework", + ); + name = "Copy Carthage Frameworks"; + outputFileListPaths = ( ); outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "carthage copy-frameworks\n"; + shellScript = "/usr/local/bin/carthage copy-frameworks\n"; }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - 39AB5FDF1FE4595000008FB3 /* Sources */ = { + 1355A47622C8A25C00EB635F /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 397334491FF6AAA600C45ECE /* MMGraphNode.swift in Sources */, - 39658ADC1FF699AA000544A2 /* MMScreenStateNode.swift in Sources */, - 39870718200D16710067B070 /* GraphRepresentation.swift in Sources */, - 39658AE21FF6A065000544A2 /* MMUserState.swift in Sources */, - 3962F22B1FF6A75800999008 /* ScreenGraphEdge.swift in Sources */, - 39658AE01FF69F62000544A2 /* MMScreenActionNode.swift in Sources */, - 39658ADE1FF69BCE000544A2 /* MMNavigator.swift in Sources */, - 3962F2291FF6A6C100999008 /* Wait.swift in Sources */, - 392FB353200E1D5D0014867E /* MMTestUtils.swift in Sources */, - 39AB5FEC1FE4597800008FB3 /* MMScreenGraph.swift in Sources */, + 1355A49F22C8A53700EB635F /* MMNode.swift in Sources */, + 1355A4A022C8A53700EB635F /* MMScreenGraph.swift in Sources */, + 1355A4A122C8A53700EB635F /* MMGraphNode.swift in Sources */, + 1355A4A222C8A53700EB635F /* MMTestUtils.swift in Sources */, + 1355A4A322C8A53700EB635F /* MMScreenActionNode.swift in Sources */, + 1355A4A422C8A53700EB635F /* MMScreenStateNode.swift in Sources */, + 1355A4A522C8A53700EB635F /* MMNavigator.swift in Sources */, + 1355A4A622C8A53700EB635F /* MMUserState.swift in Sources */, + 1355A4A722C8A53700EB635F /* GraphRepresentation.swift in Sources */, + 1355A4A822C8A53700EB635F /* ScreenGraphEdge.swift in Sources */, + 1355A4A922C8A53700EB635F /* Wait.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -374,6 +426,11 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 1355A48022C8A25C00EB635F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 1355A47922C8A25C00EB635F /* MappaMundi */; + targetProxy = 1355A47F22C8A25C00EB635F /* PBXContainerItemProxy */; + }; 39BAD5731FE19B9E00524FB7 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 39BAD55A1FE19B9D00524FB7 /* DemoApp */; @@ -401,10 +458,13 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ - 39AB5FEA1FE4595000008FB3 /* Debug */ = { + 1355A48422C8A25C00EB635F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_MODULES_AUTOLINK = YES; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; @@ -416,10 +476,14 @@ FRAMEWORK_SEARCH_PATHS = ( "$(PLATFORM_DIR)/Developer/Library/Frameworks", "$(DEVELOPER_FRAMEWORKS_DIR)", + "$(PROJECT_DIR)/Carthage/Build/iOS", ); INFOPLIST_FILE = MappaMundi/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; OTHER_LDFLAGS = ( "-weak_framework", XCTest, @@ -428,17 +492,20 @@ PRODUCT_BUNDLE_IDENTIFIER = com.mozilla.ios.MappaMundi; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Debug; }; - 39AB5FEB1FE4595000008FB3 /* Release */ = { + 1355A48522C8A25C00EB635F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_MODULES_AUTOLINK = YES; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; @@ -447,14 +514,16 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_BITCODE = NO; - ENABLE_TESTABILITY = NO; FRAMEWORK_SEARCH_PATHS = ( "$(PLATFORM_DIR)/Developer/Library/Frameworks", "$(DEVELOPER_FRAMEWORKS_DIR)", + "$(PROJECT_DIR)/Carthage/Build/iOS", ); INFOPLIST_FILE = MappaMundi/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_FAST_MATH = YES; OTHER_LDFLAGS = ( "-weak_framework", XCTest, @@ -463,7 +532,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.mozilla.ios.MappaMundi; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -528,6 +597,7 @@ SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -581,6 +651,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -588,13 +659,14 @@ 39BAD57B1FE19B9E00524FB7 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; INFOPLIST_FILE = "$(SRCROOT)/DemoApp/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mozilla.ios.MappaMundi.Demo; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -602,13 +674,14 @@ 39BAD57C1FE19B9E00524FB7 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; INFOPLIST_FILE = "$(SRCROOT)/DemoApp/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mozilla.ios.MappaMundi.Demo; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -616,13 +689,17 @@ 39BAD57E1FE19B9E00524FB7 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; CODE_SIGN_STYLE = Automatic; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); INFOPLIST_FILE = UITests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mozilla.ios.MappMundi.UITests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; TEST_TARGET_NAME = DemoApp; }; @@ -631,13 +708,17 @@ 39BAD57F1FE19B9E00524FB7 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; CODE_SIGN_STYLE = Automatic; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); INFOPLIST_FILE = UITests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mozilla.ios.MappMundi.UITests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; TEST_TARGET_NAME = DemoApp; }; @@ -646,11 +727,11 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 39AB5FE91FE4595000008FB3 /* Build configuration list for PBXNativeTarget "MappaMundi" */ = { + 1355A48322C8A25C00EB635F /* Build configuration list for PBXNativeTarget "MappaMundi" */ = { isa = XCConfigurationList; buildConfigurations = ( - 39AB5FEA1FE4595000008FB3 /* Debug */, - 39AB5FEB1FE4595000008FB3 /* Release */, + 1355A48422C8A25C00EB635F /* Debug */, + 1355A48522C8A25C00EB635F /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; diff --git a/MappaMundi.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/MappaMundi.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/MappaMundi.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/MappaMundi.xcodeproj/xcshareddata/xcschemes/DemoApp.xcscheme b/MappaMundi.xcodeproj/xcshareddata/xcschemes/DemoApp.xcscheme new file mode 100644 index 0000000..5ba0607 --- /dev/null +++ b/MappaMundi.xcodeproj/xcshareddata/xcschemes/DemoApp.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MappaMundi.xcodeproj/xcshareddata/xcschemes/DemoUITests.xcscheme b/MappaMundi.xcodeproj/xcshareddata/xcschemes/DemoUITests.xcscheme new file mode 100644 index 0000000..d3c30d8 --- /dev/null +++ b/MappaMundi.xcodeproj/xcshareddata/xcschemes/DemoUITests.xcscheme @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MappaMundi.xcodeproj/xcshareddata/xcschemes/MappaMundi.xcscheme b/MappaMundi.xcodeproj/xcshareddata/xcschemes/MappaMundi.xcscheme index d063ecc..b805e1a 100644 --- a/MappaMundi.xcodeproj/xcshareddata/xcschemes/MappaMundi.xcscheme +++ b/MappaMundi.xcodeproj/xcshareddata/xcschemes/MappaMundi.xcscheme @@ -9,12 +9,12 @@ @@ -29,15 +29,6 @@ shouldUseLaunchSchemeArgsEnv = "YES"> - - - - @@ -54,7 +45,7 @@ @@ -64,11 +55,20 @@ + + + + diff --git a/MappaMundi/Info.plist b/MappaMundi/Info.plist index 1007fd9..e1fe4cf 100644 --- a/MappaMundi/Info.plist +++ b/MappaMundi/Info.plist @@ -18,7 +18,5 @@ 1.0 CFBundleVersion $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - diff --git a/Sources/GraphRepresentation.swift b/Sources/GraphRepresentation.swift index b19f6fe..dc43bcf 100644 --- a/Sources/GraphRepresentation.swift +++ b/Sources/GraphRepresentation.swift @@ -18,7 +18,7 @@ public protocol GraphRepresentation { public extension MMScreenGraph { func stringRepresentation(_ renderer: GraphRepresentation = DotRepresentation()) -> String { - buildGkGraph() + buildGraph() renderer.begin() namedScenes.forEach { (name, node) in if let node = node as? MMScreenStateNode { diff --git a/Sources/MMGraphNode.swift b/Sources/MMGraphNode.swift index c2d6d76..4028b76 100644 --- a/Sources/MMGraphNode.swift +++ b/Sources/MMGraphNode.swift @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import Foundation -import GameplayKit public class MMGraphElement { let name: String @@ -23,14 +22,14 @@ public class MMGraphElement { public class MMGraphNode: MMGraphElement { var nodeType: String { return "Node" } - let gkNode: GKGraphNode + let mmNode: MMNode weak var map: MMScreenGraph? init(_ map: MMScreenGraph, name: String, file: String, line: UInt) { self.map = map - self.gkNode = GKGraphNode() + self.mmNode = MMNode(name: name) super.init(name: name, file: file, line: line) } diff --git a/Sources/MMNavigator.swift b/Sources/MMNavigator.swift index 6d57724..ffada53 100644 --- a/Sources/MMNavigator.swift +++ b/Sources/MMNavigator.swift @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import Foundation -import GameplayKit import XCTest +import AStar public typealias NodeVisitor = (String) -> Void @@ -63,12 +63,12 @@ open class MMNavigator { * so is not useful in the general case, but it is if you know the specific graph. */ public func can(goto nodeName: String) -> Bool { - let gkSrc = currentGraphNode.gkNode - guard let gkDest = map.namedScenes[nodeName]?.gkNode else { + let mmSrc = currentGraphNode.mmNode + guard let mmDest = map.namedScenes[nodeName]?.mmNode else { return false } - let gkPath = map.gkGraph.findPath(from: gkSrc, to: gkDest) - return gkPath.count > 0 + let mmPath = mmSrc.findPath(to: mmDest) + return mmPath.count > 0 } public func can(performAction nodeName: String, file: String = #file, line: UInt = #line) -> Bool { @@ -79,23 +79,23 @@ open class MMNavigator { } public func plan(startAt startNode: String? = nil, goto nodeName: String) -> [String] { - let gkSrc: GKGraphNode + let mmSrc: MMNode if let startNode = startNode, let node = map.namedScenes[startNode] { - gkSrc = node.gkNode + mmSrc = node.mmNode } else { - gkSrc = currentGraphNode.gkNode + mmSrc = currentGraphNode.mmNode } guard let destNode = map.namedScenes[nodeName] else { return [] } - let gkDest = destNode.gkNode - let gkPath = map.gkGraph.findPath(from: gkSrc, to: gkDest) + let mmDest = destNode.mmNode + let mmPath = mmSrc.findPath(to: mmDest) - let path = gkPath.compactMap { gkNode in - return self.map.nodedScenes[gkNode]?.name + let path = mmPath.compactMap { mmNode in + return self.map.nodedScenes[mmNode]?.name } if path.isEmpty { @@ -126,14 +126,15 @@ open class MMNavigator { * node changes. */ public func goto(_ nodeName: String, file: String = #file, line: UInt = #line, visitWith nodeVisitor: @escaping NodeVisitor) { - let gkSrc = currentGraphNode.gkNode - guard let gkDest = map.namedScenes[nodeName]?.gkNode else { + let mmSrc = currentGraphNode.mmNode + guard let mmDest = map.namedScenes[nodeName]?.mmNode else { xcTest.recordFailure(withDescription: "Cannot route to \(nodeName), because it doesn't exist", inFile: file, atLine: Int(line), expected: false) return } + + var mmPath = mmSrc.findPath(to: mmDest) - var gkPath = map.gkGraph.findPath(from: gkSrc, to: gkDest) - guard gkPath.count > 0 else { + guard mmPath.count > 0 else { xcTest.recordFailure(withDescription: "Cannot route from \(currentGraphNode.name) to \(nodeName)", inFile: file, atLine: Int(line), expected: false) return } @@ -163,8 +164,8 @@ open class MMNavigator { return maybeStateChanged && self.userStateShouldChangeGraph(userState) } - gkPath.removeFirst() - let graphNodes = gkPath.compactMap { map.nodedScenes[$0] } + mmPath.removeFirst() + let graphNodes = mmPath.compactMap { map.nodedScenes[$0] } for i in 0 ..< graphNodes.count { let graphChanged = moveDirectlyTo(graphNodes[i]) @@ -314,7 +315,7 @@ fileprivate extension MMNavigator { // currentScene is the state we're returning from. // nextScene is the state we're returning to. exitingNode.returnNode = nil - exitingNode.gkNode.removeConnections(to: [ nextNode.gkNode ], bidirectional: false) + exitingNode.mmNode.connectedNodes.remove(nextNode.mmNode) } } } @@ -344,7 +345,7 @@ fileprivate extension MMNavigator { if let backAction = enteringNode.backAction { if enteringNode.returnNode == nil { enteringNode.returnNode = returnToRecentScene - enteringNode.gkNode.addConnections(to: [ returnToRecentScene.gkNode ], bidirectional: false) + enteringNode.mmNode.connectedNodes.insert(returnToRecentScene.mmNode) enteringNode.gesture(to: returnToRecentScene.name, g: backAction) } } else { @@ -360,7 +361,7 @@ fileprivate extension MMNavigator { thisScene.returnNode = nil thisScene.edges.removeValue(forKey: prevScene.name) - thisScene.gkNode.removeConnections(to: [ prevScene.gkNode ], bidirectional: false) + thisScene.mmNode.connectedNodes.remove(prevScene.mmNode) screen = prevScene } @@ -417,9 +418,9 @@ fileprivate extension MMNavigator { } graphChanged = true if edge.isOpen { - edge.src.addConnections(to: [edge.dest], bidirectional: false) + edge.src.connectedNodes.insert(edge.dest) } else { - edge.src.removeConnections(to: [edge.dest], bidirectional: false) + edge.src.connectedNodes.remove(edge.dest) } } return graphChanged diff --git a/Sources/MMNode.swift b/Sources/MMNode.swift new file mode 100644 index 0000000..f6c60f4 --- /dev/null +++ b/Sources/MMNode.swift @@ -0,0 +1,31 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +import AStar +final class MMNode: GraphNode { + var name: String? + + convenience init(name: String) { + self.init() + self.name = name + } + + static func == (lhs: MMNode, rhs: MMNode) -> Bool { + return lhs.name == rhs.name + } + + func hash(into hasher: inout Hasher) { + hasher.combine(self.name) + } + + var connectedNodes = Set() + + func cost(to node: MMNode) -> Float { + return 1 + } + + func estimatedCost(to node: MMNode) -> Float { + return cost(to: node) + } +} diff --git a/Sources/MMScreenGraph.swift b/Sources/MMScreenGraph.swift index b4b4592..b34411c 100644 --- a/Sources/MMScreenGraph.swift +++ b/Sources/MMScreenGraph.swift @@ -12,11 +12,10 @@ * * The shared graph may also have other uses, such as generating screen shots for the App Store or L10n translators. * - * Under the hood, the MappaMundi is using GameplayKit's path finding to do the heavy lifting. + * Under the hood, the MappaMundi is using A* path finding to do the heavy lifting. */ import Foundation -import GameplayKit import XCTest public typealias MMScreenStateBuilder = (MMScreenStateNode) -> Void @@ -32,19 +31,18 @@ open class MMScreenGraph { let xcTest: XCTestCase var namedScenes: [String: MMGraphNode] = [:] - var nodedScenes: [GKGraphNode: MMGraphNode] = [:] + var nodedScenes: [MMNode: MMGraphNode] = [:] var conditionalEdges: [ConditionalEdge] = [] fileprivate var isReady: Bool = false - let gkGraph: GKGraph - + let rootNode: MMNode public typealias UserStateChange = (T) -> () fileprivate let defaultStateRecorder: UserStateChange = { _ in } public init(for test: XCTestCase, with userStateType: T.Type) { - self.gkGraph = GKGraph() + self.rootNode = MMNode() self.userStateType = userStateType self.xcTest = test } @@ -191,7 +189,7 @@ public extension MMScreenGraph { * Typically, you'll do this in `TestCase.setUp()` */ func navigator(startingAt: String? = nil, file: String = #file, line: UInt = #line) -> MMNavigator { - buildGkGraph() + buildGraph() let userState = userStateType.init() guard let name = startingAt ?? userState.initialScreenState, let startingScreenState = namedScenes[name] as? MMScreenStateNode else { @@ -205,7 +203,7 @@ public extension MMScreenGraph { return MMNavigator(self, xcTest: xcTest, startingScreenState: startingScreenState, userState: userState) } - func buildGkGraph() { + func buildGraph() { if isReady { return } @@ -222,24 +220,28 @@ public extension MMScreenGraph { } } - // Construct all the GKGraphNodes, and add them to the GKGraph. + // Construct all the MMNodes, and add them to the rootNode. let graphNodes = namedScenes.values - gkGraph.add(graphNodes.map { $0.gkNode }) - + graphNodes.forEach({ + rootNode.connectedNodes.insert($0.mmNode) + }) + graphNodes.forEach { graphNode in - nodedScenes[graphNode.gkNode] = graphNode + nodedScenes[graphNode.mmNode] = graphNode } // Now, we should have a good idea what the edges of the nodes look like, - // so we need to construct the GKGraph edges from it. + // so we need to construct the edges from it. graphNodes.forEach { graphNode in if let screenStateNode = graphNode as? MMScreenStateNode { - let gkNodes = screenStateNode.edges.keys.compactMap { self.namedScenes[$0]?.gkNode } as [GKGraphNode] - screenStateNode.gkNode.addConnections(to: gkNodes, bidirectional: false) + let mmNodes = screenStateNode.edges.keys.compactMap { self.namedScenes[$0]?.mmNode } as [MMNode] + mmNodes.forEach{ + screenStateNode.mmNode.connectedNodes.insert($0) + } } else if let screenActionNode = graphNode as? MMScreenActionNode { if let destName = screenActionNode.nextNodeName, - let destGkNode = namedScenes[destName]?.gkNode { - screenActionNode.gkNode.addConnections(to: [destGkNode], bidirectional: false) + let destNode = namedScenes[destName]?.mmNode { + screenActionNode.mmNode.connectedNodes.insert(destNode) } } } @@ -248,14 +250,14 @@ public extension MMScreenGraph { } fileprivate func calculateConditionalEdges() -> [ConditionalEdge] { - buildGkGraph() + buildGraph() let screenStateNodes = namedScenes.values.compactMap { $0 as? MMScreenStateNode } return screenStateNodes.map { node -> [ConditionalEdge] in - let src = node.gkNode + let src = node.mmNode return node.edges.values.compactMap { edge -> ConditionalEdge? in guard let predicate = edge.predicate, - let dest = self.namedScenes[edge.destinationName]?.gkNode else { return nil } + let dest = self.namedScenes[edge.destinationName]?.mmNode else { return nil } return ConditionalEdge(src: src, dest: dest, predicate: predicate) } as [ConditionalEdge] diff --git a/Sources/MMScreenStateNode.swift b/Sources/MMScreenStateNode.swift index 15c428e..4a784c0 100644 --- a/Sources/MMScreenStateNode.swift +++ b/Sources/MMScreenStateNode.swift @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import Foundation -import GameplayKit import XCTest /** @@ -57,7 +56,7 @@ public class MMScreenStateNode: MMGraphNode { fileprivate func addEdge(_ dest: String, by edge: Edge) { edges[dest] = edge - // by this time, we should've added all nodes in to the gkGraph. + // by this time, we should've added all nodes in to the rootNode. assert(map?.namedScenes[dest] != nil, "Destination node '\(dest)' has not been created anywhere") } diff --git a/Sources/ScreenGraphEdge.swift b/Sources/ScreenGraphEdge.swift index 75f206d..2563f23 100644 --- a/Sources/ScreenGraphEdge.swift +++ b/Sources/ScreenGraphEdge.swift @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import Foundation -import GameplayKit import XCTest // These are two data structures that define an edge between nodes. @@ -23,12 +22,12 @@ struct Edge { // re-evaluated. class ConditionalEdge { let predicate: NSPredicate - let src: GKGraphNode - let dest: GKGraphNode + let src: MMNode + let dest: MMNode var isOpen: Bool = true - init(src: GKGraphNode, dest: GKGraphNode, predicate: NSPredicate) { + init(src: MMNode, dest: MMNode, predicate: NSPredicate) { self.src = src self.dest = dest self.predicate = predicate diff --git a/UITests/DemoMappaMundi.swift b/UITests/DemoMappaMundi.swift index 78ab379..040d5de 100644 --- a/UITests/DemoMappaMundi.swift +++ b/UITests/DemoMappaMundi.swift @@ -75,10 +75,9 @@ func createGraph(with app: XCUIApplication, for test: XCTestCase) -> MMScreenGra // The edit screen has a delete action. We can also map.addScreenState(Screens.itemListEditing) { screenState in let table = app.tables.element(boundBy: 0) - func deleteFirst(_ userState: DemoAppUserState) { table.cells.element(boundBy: 0).buttons.element(boundBy: 0).tap() - table.buttons["Delete"].tap() + table.buttons["Delete"].firstMatch.tap() userState.numItems -= 1 } @@ -90,6 +89,8 @@ func createGraph(with app: XCUIApplication, for test: XCTestCase) -> MMScreenGra screenState.gesture(forAction: Actions.deleteAllItems) { userState in for _ in 0 ..< userState.numItems { deleteFirst(userState) + //waiting for the animation to finish + sleep(1) } }