ソースを参照

Chapter 5 starting code

Admin 5 年 前
コミット
ee1cb1ae0e
22 ファイル変更2271 行追加154 行削除
  1. 0 0
      Landmarks/AnimatingViewsAndTransitions.xcodeproj/.xcodesamplecode.plist
  2. 61 37
      Landmarks/DrawingPathsAndShapes.xcodeproj/project.pbxproj
  3. 0 0
      Landmarks/AnimatingViewsAndTransitions.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
  4. 0 8
      Landmarks/DrawingPathsAndShapes.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
  5. BIN
      Landmarks/DrawingPathsAndShapes.xcodeproj/project.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
  6. 0 6
      Landmarks/DrawingPathsAndShapes.xcodeproj/xcuserdata/admin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  7. 0 14
      Landmarks/DrawingPathsAndShapes.xcodeproj/xcuserdata/admin.xcuserdatad/xcschemes/xcschememanagement.plist
  8. 8 7
      Landmarks/Landmarks/Assets.xcassets/AppIcon.appiconset/Contents.json
  9. BIN
      Landmarks/Landmarks/Assets.xcassets/AppIcon.appiconset/landmark_app_icon_76x76.png
  10. 0 50
      Landmarks/Landmarks/BadgeSymbol.swift
  11. 47 0
      Landmarks/Landmarks/HikeDetail.swift
  12. 54 0
      Landmarks/Landmarks/HikeView.swift
  13. 5 3
      Landmarks/Landmarks/Models/Data.swift
  14. 31 0
      Landmarks/Landmarks/Models/Hike.swift
  15. 1882 0
      Landmarks/Landmarks/Resources/hikeData.json
  16. 9 11
      Landmarks/Landmarks/Badge.swift
  17. 7 7
      Landmarks/Landmarks/BadgeBackground.swift
  18. 49 0
      Landmarks/Landmarks/Supporting Views/BadgeSymbol.swift
  19. 36 0
      Landmarks/Landmarks/Supporting Views/GraphCapsule.swift
  20. 72 0
      Landmarks/Landmarks/Supporting Views/HikeGraph.swift
  21. 8 9
      Landmarks/Landmarks/RotatedBadgeSymbol.swift
  22. 2 2
      README.md

Landmarks/DrawingPathsAndShapes.xcodeproj/.xcodesamplecode.plist → Landmarks/AnimatingViewsAndTransitions.xcodeproj/.xcodesamplecode.plist


+ 61 - 37
Landmarks/DrawingPathsAndShapes.xcodeproj/project.pbxproj

@@ -7,11 +7,8 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
-		845967802543064F008C197E /* Badge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8459677F2543064F008C197E /* Badge.swift */; };
-		8459678325431F38008C197E /* BadgeBackground.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8459678225431F38008C197E /* BadgeBackground.swift */; };
-		8459678625431F94008C197E /* BadgeSymbol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8459678525431F94008C197E /* BadgeSymbol.swift */; };
-		84596789254323E2008C197E /* RotatedBadgeSymbol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84596788254323E2008C197E /* RotatedBadgeSymbol.swift */; };
 		B7310DD1229F6839001079B9 /* HexagonParameters.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7310DD0229F6839001079B9 /* HexagonParameters.swift */; };
+		B7310DD3229F6CA9001079B9 /* Badge.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7310DD2229F6CA9001079B9 /* Badge.swift */; };
 		B7394866229F194000C47603 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7394865229F194000C47603 /* AppDelegate.swift */; };
 		B7394868229F194000C47603 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7394867229F194000C47603 /* SceneDelegate.swift */; };
 		B739486A229F194000C47603 /* LandmarkDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7394869229F194000C47603 /* LandmarkDetail.swift */; };
@@ -38,15 +35,22 @@
 		B73948A1229F2E1F00C47603 /* LandmarkList.swift in Sources */ = {isa = PBXBuildFile; fileRef = B73948A0229F2E1F00C47603 /* LandmarkList.swift */; };
 		B73948A3229F3E2200C47603 /* charleyrivers.jpg in Resources */ = {isa = PBXBuildFile; fileRef = B73948A2229F3E2200C47603 /* charleyrivers.jpg */; };
 		B7D2AAC5229F4D7C0061E5F5 /* UserData.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7D2AAC4229F4D7C0061E5F5 /* UserData.swift */; };
+		B7D587AE229F7382006E8DCF /* BadgeBackground.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7D587AD229F7382006E8DCF /* BadgeBackground.swift */; };
+		B7D587B0229F73C1006E8DCF /* BadgeSymbol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7D587AF229F73C1006E8DCF /* BadgeSymbol.swift */; };
+		B7D587B2229F7406006E8DCF /* RotatedBadgeSymbol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7D587B1229F7406006E8DCF /* RotatedBadgeSymbol.swift */; };
+		B7D587B6229F825D006E8DCF /* HikeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7D587B5229F825D006E8DCF /* HikeView.swift */; };
+		B7D587B8229F826D006E8DCF /* GraphCapsule.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7D587B7229F826D006E8DCF /* GraphCapsule.swift */; };
+		B7D587BA229F8288006E8DCF /* Hike.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7D587B9229F8288006E8DCF /* Hike.swift */; };
+		B7D587BC229F82EB006E8DCF /* HikeDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7D587BB229F82EB006E8DCF /* HikeDetail.swift */; };
+		B7D587BE229F82FF006E8DCF /* HikeGraph.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7D587BD229F82FF006E8DCF /* HikeGraph.swift */; };
+		B7D587C0229F830B006E8DCF /* hikeData.json in Resources */ = {isa = PBXBuildFile; fileRef = B7D587BF229F830B006E8DCF /* hikeData.json */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
-		27FFE5444DA58085F4325C68 /* LICENSE.txt */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = LICENSE.txt; sourceTree = "<group>"; };
-		8459677F2543064F008C197E /* Badge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Badge.swift; sourceTree = "<group>"; };
-		8459678225431F38008C197E /* BadgeBackground.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BadgeBackground.swift; sourceTree = "<group>"; };
-		8459678525431F94008C197E /* BadgeSymbol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BadgeSymbol.swift; sourceTree = "<group>"; };
-		84596788254323E2008C197E /* RotatedBadgeSymbol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RotatedBadgeSymbol.swift; sourceTree = "<group>"; };
+		0790415854E952624FBB8A39 /* LICENSE.txt */ = {isa = PBXFileReference; includeInIndex = 1; path = LICENSE.txt; sourceTree = "<group>"; };
+		A99FE5B13E0F2F6966AAD73C /* SampleCode.xcconfig */ = {isa = PBXFileReference; name = SampleCode.xcconfig; path = ../Configuration/SampleCode.xcconfig; sourceTree = "<group>"; };
 		B7310DD0229F6839001079B9 /* HexagonParameters.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HexagonParameters.swift; sourceTree = "<group>"; };
+		B7310DD2229F6CA9001079B9 /* Badge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Badge.swift; sourceTree = "<group>"; };
 		B7394862229F194000C47603 /* Landmarks.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Landmarks.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		B7394865229F194000C47603 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
 		B7394867229F194000C47603 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
@@ -75,7 +79,15 @@
 		B73948A0229F2E1F00C47603 /* LandmarkList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LandmarkList.swift; sourceTree = "<group>"; };
 		B73948A2229F3E2200C47603 /* charleyrivers.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = charleyrivers.jpg; sourceTree = "<group>"; };
 		B7D2AAC4229F4D7C0061E5F5 /* UserData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserData.swift; sourceTree = "<group>"; };
-		B8A4CAA78D6B798B07B45529 /* SampleCode.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = SampleCode.xcconfig; path = ../Configuration/SampleCode.xcconfig; sourceTree = "<group>"; };
+		B7D587AD229F7382006E8DCF /* BadgeBackground.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BadgeBackground.swift; sourceTree = "<group>"; };
+		B7D587AF229F73C1006E8DCF /* BadgeSymbol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BadgeSymbol.swift; sourceTree = "<group>"; };
+		B7D587B1229F7406006E8DCF /* RotatedBadgeSymbol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RotatedBadgeSymbol.swift; sourceTree = "<group>"; };
+		B7D587B5229F825D006E8DCF /* HikeView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HikeView.swift; sourceTree = "<group>"; };
+		B7D587B7229F826D006E8DCF /* GraphCapsule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphCapsule.swift; sourceTree = "<group>"; };
+		B7D587B9229F8288006E8DCF /* Hike.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Hike.swift; sourceTree = "<group>"; };
+		B7D587BB229F82EB006E8DCF /* HikeDetail.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HikeDetail.swift; sourceTree = "<group>"; };
+		B7D587BD229F82FF006E8DCF /* HikeGraph.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HikeGraph.swift; sourceTree = "<group>"; };
+		B7D587BF229F830B006E8DCF /* hikeData.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = hikeData.json; sourceTree = "<group>"; };
 		C4E4AAA0C4E4035000000001 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
@@ -90,22 +102,31 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
-		8BF134F5A54BCFC44BB3699D /* Configuration */ = {
+		01795E30021484A2CDCC41E5 /* Configuration */ = {
 			isa = PBXGroup;
 			children = (
-				B8A4CAA78D6B798B07B45529 /* SampleCode.xcconfig */,
+				A99FE5B13E0F2F6966AAD73C /* SampleCode.xcconfig */,
 			);
 			name = Configuration;
 			sourceTree = "<group>";
 		};
+		44D158F0BA5EF8127E1B150D /* LICENSE */ = {
+			isa = PBXGroup;
+			children = (
+				0790415854E952624FBB8A39 /* LICENSE.txt */,
+			);
+			name = LICENSE;
+			path = ../LICENSE;
+			sourceTree = "<group>";
+		};
 		B7394859229F194000C47603 = {
 			isa = PBXGroup;
 			children = (
 				C4E4AAA0C4E4035000000001 /* README.md */,
 				B7394864229F194000C47603 /* Landmarks */,
 				B7394863229F194000C47603 /* Products */,
-				8BF134F5A54BCFC44BB3699D /* Configuration */,
-				F0E92604CFEDA83BAF383A9E /* LICENSE */,
+				01795E30021484A2CDCC41E5 /* Configuration */,
+				44D158F0BA5EF8127E1B150D /* LICENSE */,
 			);
 			sourceTree = "<group>";
 		};
@@ -126,6 +147,8 @@
 				B73948A0229F2E1F00C47603 /* LandmarkList.swift */,
 				B739489E229F2D9700C47603 /* LandmarkRow.swift */,
 				B7394869229F194000C47603 /* LandmarkDetail.swift */,
+				B7D587B5229F825D006E8DCF /* HikeView.swift */,
+				B7D587BB229F82EB006E8DCF /* HikeDetail.swift */,
 				B7310DD0229F6839001079B9 /* HexagonParameters.swift */,
 				B739487D229F1C0100C47603 /* Supporting Views */,
 				B7394883229F291A00C47603 /* Resources */,
@@ -133,10 +156,6 @@
 				B7394870229F194200C47603 /* LaunchScreen.storyboard */,
 				B7394873229F194200C47603 /* Info.plist */,
 				B739486D229F194200C47603 /* Preview Content */,
-				8459677F2543064F008C197E /* Badge.swift */,
-				8459678525431F94008C197E /* BadgeSymbol.swift */,
-				84596788254323E2008C197E /* RotatedBadgeSymbol.swift */,
-				8459678225431F38008C197E /* BadgeBackground.swift */,
 			);
 			path = Landmarks;
 			sourceTree = "<group>";
@@ -154,6 +173,12 @@
 			children = (
 				B7394879229F1B3F00C47603 /* CircleImage.swift */,
 				B739487B229F1B6800C47603 /* MapView.swift */,
+				B7310DD2229F6CA9001079B9 /* Badge.swift */,
+				B7D587AF229F73C1006E8DCF /* BadgeSymbol.swift */,
+				B7D587B1229F7406006E8DCF /* RotatedBadgeSymbol.swift */,
+				B7D587AD229F7382006E8DCF /* BadgeBackground.swift */,
+				B7D587BD229F82FF006E8DCF /* HikeGraph.swift */,
+				B7D587B7229F826D006E8DCF /* GraphCapsule.swift */,
 			);
 			path = "Supporting Views";
 			sourceTree = "<group>";
@@ -163,6 +188,7 @@
 			children = (
 				B7394880229F28B900C47603 /* Data.swift */,
 				B739487F229F28B900C47603 /* Landmark.swift */,
+				B7D587B9229F8288006E8DCF /* Hike.swift */,
 				B7D2AAC4229F4D7C0061E5F5 /* UserData.swift */,
 			);
 			path = Models;
@@ -172,6 +198,7 @@
 			isa = PBXGroup;
 			children = (
 				B739488E229F292E00C47603 /* landmarkData.json */,
+				B7D587BF229F830B006E8DCF /* hikeData.json */,
 				B7394890229F292F00C47603 /* chilkoottrail.jpg */,
 				B739488F229F292F00C47603 /* chincoteague.jpg */,
 				B739488A229F292E00C47603 /* hiddenlake.jpg */,
@@ -188,15 +215,6 @@
 			path = Resources;
 			sourceTree = "<group>";
 		};
-		F0E92604CFEDA83BAF383A9E /* LICENSE */ = {
-			isa = PBXGroup;
-			children = (
-				27FFE5444DA58085F4325C68 /* LICENSE.txt */,
-			);
-			name = LICENSE;
-			path = ../LICENSE;
-			sourceTree = "<group>";
-		};
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
@@ -232,7 +250,7 @@
 					};
 				};
 			};
-			buildConfigurationList = B739485D229F194000C47603 /* Build configuration list for PBXProject "DrawingPathsAndShapes" */;
+			buildConfigurationList = B739485D229F194000C47603 /* Build configuration list for PBXProject "AnimatingViewsAndTransitions" */;
 			compatibilityVersion = "Xcode 9.3";
 			developmentRegion = en;
 			hasScannedForEncodings = 0;
@@ -257,6 +275,7 @@
 			files = (
 				B739489A229F292F00C47603 /* silversalmoncreek.jpg in Resources */,
 				B7394894229F292F00C47603 /* lakemcdonald.jpg in Resources */,
+				B7D587C0229F830B006E8DCF /* hikeData.json in Resources */,
 				B7394872229F194200C47603 /* LaunchScreen.storyboard in Resources */,
 				B73948A3229F3E2200C47603 /* charleyrivers.jpg in Resources */,
 				B7394891229F292F00C47603 /* rainbowlake.jpg in Resources */,
@@ -282,16 +301,21 @@
 			buildActionMask = 2147483647;
 			files = (
 				B7394882229F28B900C47603 /* Data.swift in Sources */,
-				845967802543064F008C197E /* Badge.swift in Sources */,
+				B7310DD3229F6CA9001079B9 /* Badge.swift in Sources */,
 				B7394866229F194000C47603 /* AppDelegate.swift in Sources */,
+				B7D587B8229F826D006E8DCF /* GraphCapsule.swift in Sources */,
 				B739487A229F1B3F00C47603 /* CircleImage.swift in Sources */,
 				B739487C229F1B6800C47603 /* MapView.swift in Sources */,
+				B7D587BA229F8288006E8DCF /* Hike.swift in Sources */,
+				B7D587BC229F82EB006E8DCF /* HikeDetail.swift in Sources */,
+				B7D587B6229F825D006E8DCF /* HikeView.swift in Sources */,
 				B7310DD1229F6839001079B9 /* HexagonParameters.swift in Sources */,
 				B73948A1229F2E1F00C47603 /* LandmarkList.swift in Sources */,
-				8459678625431F94008C197E /* BadgeSymbol.swift in Sources */,
-				84596789254323E2008C197E /* RotatedBadgeSymbol.swift in Sources */,
+				B7D587B0229F73C1006E8DCF /* BadgeSymbol.swift in Sources */,
+				B7D587B2229F7406006E8DCF /* RotatedBadgeSymbol.swift in Sources */,
+				B7D587BE229F82FF006E8DCF /* HikeGraph.swift in Sources */,
 				B7394868229F194000C47603 /* SceneDelegate.swift in Sources */,
-				8459678325431F38008C197E /* BadgeBackground.swift in Sources */,
+				B7D587AE229F7382006E8DCF /* BadgeBackground.swift in Sources */,
 				B739486A229F194000C47603 /* LandmarkDetail.swift in Sources */,
 				B739489F229F2D9700C47603 /* LandmarkRow.swift in Sources */,
 				B7D2AAC5229F4D7C0061E5F5 /* UserData.swift in Sources */,
@@ -315,7 +339,7 @@
 /* Begin XCBuildConfiguration section */
 		B7394874229F194200C47603 /* Debug */ = {
 			isa = XCBuildConfiguration;
-			baseConfigurationReference = B8A4CAA78D6B798B07B45529 /* SampleCode.xcconfig */;
+			baseConfigurationReference = A99FE5B13E0F2F6966AAD73C /* SampleCode.xcconfig */;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				CLANG_ANALYZER_NONNULL = YES;
@@ -377,7 +401,7 @@
 		};
 		B7394875229F194200C47603 /* Release */ = {
 			isa = XCBuildConfiguration;
-			baseConfigurationReference = B8A4CAA78D6B798B07B45529 /* SampleCode.xcconfig */;
+			baseConfigurationReference = A99FE5B13E0F2F6966AAD73C /* SampleCode.xcconfig */;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				CLANG_ANALYZER_NONNULL = YES;
@@ -433,7 +457,7 @@
 		};
 		B7394877229F194200C47603 /* Debug */ = {
 			isa = XCBuildConfiguration;
-			baseConfigurationReference = B8A4CAA78D6B798B07B45529 /* SampleCode.xcconfig */;
+			baseConfigurationReference = A99FE5B13E0F2F6966AAD73C /* SampleCode.xcconfig */;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CODE_SIGN_STYLE = Automatic;
@@ -455,7 +479,7 @@
 		};
 		B7394878229F194200C47603 /* Release */ = {
 			isa = XCBuildConfiguration;
-			baseConfigurationReference = B8A4CAA78D6B798B07B45529 /* SampleCode.xcconfig */;
+			baseConfigurationReference = A99FE5B13E0F2F6966AAD73C /* SampleCode.xcconfig */;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CODE_SIGN_STYLE = Automatic;
@@ -478,7 +502,7 @@
 /* End XCBuildConfiguration section */
 
 /* Begin XCConfigurationList section */
-		B739485D229F194000C47603 /* Build configuration list for PBXProject "DrawingPathsAndShapes" */ = {
+		B739485D229F194000C47603 /* Build configuration list for PBXProject "AnimatingViewsAndTransitions" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				B7394874229F194200C47603 /* Debug */,

Landmarks/DrawingPathsAndShapes.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings → Landmarks/AnimatingViewsAndTransitions.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings


+ 0 - 8
Landmarks/DrawingPathsAndShapes.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist

@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>IDEDidComputeMac32BitWarning</key>
-	<true/>
-</dict>
-</plist>

BIN
Landmarks/DrawingPathsAndShapes.xcodeproj/project.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate


+ 0 - 6
Landmarks/DrawingPathsAndShapes.xcodeproj/xcuserdata/admin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Bucket
-   uuid = "442118A6-D5B6-496A-8BC4-4AB0D5399D33"
-   type = "1"
-   version = "2.0">
-</Bucket>

+ 0 - 14
Landmarks/DrawingPathsAndShapes.xcodeproj/xcuserdata/admin.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>SchemeUserState</key>
-	<dict>
-		<key>Landmarks.xcscheme_^#shared#^_</key>
-		<dict>
-			<key>orderHint</key>
-			<integer>0</integer>
-		</dict>
-	</dict>
-</dict>
-</plist>

+ 8 - 7
Landmarks/Landmarks/Assets.xcassets/AppIcon.appiconset/Contents.json

@@ -26,19 +26,19 @@
     {
       "size" : "40x40",
       "idiom" : "iphone",
-      "filename" : "landmark_app_icon_80x80.png",
+      "filename" : "landmark_app_icon_80x80-1.png",
       "scale" : "2x"
     },
     {
       "size" : "40x40",
       "idiom" : "iphone",
-      "filename" : "landmark_app_icon_120x120.png",
+      "filename" : "landmark_app_icon_120x120-1.png",
       "scale" : "3x"
     },
     {
       "size" : "60x60",
       "idiom" : "iphone",
-      "filename" : "landmark_app_icon_120x120-1.png",
+      "filename" : "landmark_app_icon_120x120.png",
       "scale" : "2x"
     },
     {
@@ -55,7 +55,7 @@
     {
       "size" : "20x20",
       "idiom" : "ipad",
-      "filename" : "landmark_app_icon_40x40-1.png",
+      "filename" : "landmark_app_icon_40x40-2.png",
       "scale" : "2x"
     },
     {
@@ -72,18 +72,19 @@
     {
       "size" : "40x40",
       "idiom" : "ipad",
-      "filename" : "landmark_app_icon_40x40-2.png",
+      "filename" : "landmark_app_icon_40x40-1.png",
       "scale" : "1x"
     },
     {
       "size" : "40x40",
       "idiom" : "ipad",
-      "filename" : "landmark_app_icon_80x80-1.png",
+      "filename" : "landmark_app_icon_80x80.png",
       "scale" : "2x"
     },
     {
-      "idiom" : "ipad",
       "size" : "76x76",
+      "idiom" : "ipad",
+      "filename" : "landmark_app_icon_76x76.png",
       "scale" : "1x"
     },
     {

BIN
Landmarks/Landmarks/Assets.xcassets/AppIcon.appiconset/landmark_app_icon_76x76.png


+ 0 - 50
Landmarks/Landmarks/BadgeSymbol.swift

@@ -1,50 +0,0 @@
-//
-//  BadgeSymbol.swift
-//  Landmarks
-//
-//  Created by Admin on 23.10.2020.
-//  Copyright © 2020 Apple. All rights reserved.
-//
-
-import SwiftUI
-
-struct BadgeSymbol: View {
-    let symbolcolor = Color(red: 79.0/255, green: 79.0/255, blue: 191.0/255)
-    
-    var body: some View {
-        GeometryReader{ geometry in
-            Path{ path in
-                let width = min(geometry.size.width, geometry.size.height)
-                let height = width * 0.75
-                let spacing = width * 0.030
-                let middle = width / 2
-                let topWidth = 0.226 * width
-                let topHeight = 0.488 * height
-                
-                path.addLines([
-                    CGPoint(x: middle, y: spacing),
-                    CGPoint(x: middle-topWidth, y: topHeight - spacing),
-                    CGPoint(x: middle, y:topHeight / 2 + spacing),
-                    CGPoint(x: middle + topWidth, y: topHeight - spacing),
-                    CGPoint(x: middle, y: spacing)
-                ])
-                
-                path.move(to: CGPoint(x: middle, y: topHeight/2 + spacing*3))
-                path.addLines([
-                    CGPoint(x: middle-topWidth, y: topHeight+spacing),
-                    CGPoint(x: spacing, y: height-spacing),
-                    CGPoint(x: width-spacing, y: height-spacing),
-                    CGPoint(x: middle+topWidth, y: topHeight+spacing),
-                    CGPoint(x: middle, y: topHeight/2 + spacing*3)
-                ])
-            }
-            .fill(symbolcolor)
-        }
-    }
-}
-
-struct BadgeSymbol_Previews: PreviewProvider {
-    static var previews: some View {
-        BadgeSymbol()
-    }
-}

+ 47 - 0
Landmarks/Landmarks/HikeDetail.swift

@@ -0,0 +1,47 @@
+/*
+See LICENSE folder for this sample’s licensing information.
+
+Abstract:
+A view showing the details for a hike.
+*/
+
+import SwiftUI
+
+struct HikeDetail: View {
+    let hike: Hike
+    @State var dataToShow = \Hike.Observation.elevation
+    
+    var buttons = [
+        ("Elevation", \Hike.Observation.elevation),
+        ("Heart Rate", \Hike.Observation.heartRate),
+        ("Pace", \Hike.Observation.pace),
+    ]
+    
+    var body: some View {
+        return VStack {
+            HikeGraph(hike: hike, path: dataToShow)
+                .frame(height: 200)
+            
+            HStack(spacing: 25) {
+                ForEach(buttons, id: \.0) { value in
+                    Button(action: {
+                        self.dataToShow = value.1
+                    }) {
+                        Text(value.0)
+                            .font(.system(size: 15))
+                            .foregroundColor(value.1 == self.dataToShow
+                                ? Color.gray
+                                : Color.accentColor)
+                            .animation(nil)
+                    }
+                }
+            }
+        }
+    }
+}
+
+struct HikeDetail_Previews: PreviewProvider {
+    static var previews: some View {
+        HikeDetail(hike: hikeData[0])
+    }
+}

+ 54 - 0
Landmarks/Landmarks/HikeView.swift

@@ -0,0 +1,54 @@
+/*
+See LICENSE folder for this sample’s licensing information.
+
+Abstract:
+A view displaying information about a hike, including an elevation graph.
+*/
+
+import SwiftUI
+
+struct HikeView: View {
+    var hike: Hike
+    @State private var showDetail = false
+    
+    var body: some View {
+        VStack {
+            HStack {
+                HikeGraph(hike: hike, path: \.elevation)
+                    .frame(width: 50, height: 30)
+                    .animation(nil)
+                
+                VStack(alignment: .leading) {
+                    Text(hike.name)
+                        .font(.headline)
+                    Text(hike.distanceText)
+                }
+                
+                Spacer()
+
+                Button(action: {
+                    self.showDetail.toggle()
+                }) {
+                    Image(systemName: "chevron.right.circle")
+                        .imageScale(.large)
+                        .rotationEffect(.degrees(showDetail ? 90 : 0))
+                        .padding()
+                }
+            }
+
+            if showDetail {
+                HikeDetail(hike: hike)
+            }
+        }
+    }
+}
+
+struct HikeView_Previews: PreviewProvider {
+    static var previews: some View {
+        VStack {
+            HikeView(hike: hikeData[0])
+                .padding()
+            Spacer()
+        }
+    }
+}

+ 5 - 3
Landmarks/Landmarks/Models/Data.swift

@@ -5,18 +5,20 @@ Abstract:
 Helpers for loading images and data.
 */
 
+import Foundation
+import CoreLocation
 import UIKit
 import SwiftUI
-import CoreLocation
 
 let landmarkData: [Landmark] = load("landmarkData.json")
+let hikeData: [Hike] = load("hikeData.json")
 
 func load<T: Decodable>(_ filename: String) -> T {
     let data: Data
     
     guard let file = Bundle.main.url(forResource: filename, withExtension: nil)
-        else {
-            fatalError("Couldn't find \(filename) in main bundle.")
+    else {
+        fatalError("Couldn't find \(filename) in main bundle.")
     }
     
     do {

+ 31 - 0
Landmarks/Landmarks/Models/Hike.swift

@@ -0,0 +1,31 @@
+/*
+See LICENSE folder for this sample’s licensing information.
+
+Abstract:
+The model for a hike.
+*/
+
+import SwiftUI
+
+struct Hike: Codable, Hashable, Identifiable {
+    var name: String
+    var id: Int
+    var distance: Double
+    var difficulty: Int
+    var observations: [Observation]
+
+    static var formatter = LengthFormatter()
+    
+    var distanceText: String {
+        return Hike.formatter
+            .string(fromValue: distance, unit: .kilometer)
+    }
+
+    struct Observation: Codable, Hashable {
+        var distanceFromStart: Double
+        
+        var elevation: Range<Double>
+        var pace: Range<Double>
+        var heartRate: Range<Double>
+    }
+}

ファイルの差分が大きいため隠しています
+ 1882 - 0
Landmarks/Landmarks/Resources/hikeData.json


+ 9 - 11
Landmarks/Landmarks/Badge.swift

@@ -1,10 +1,9 @@
-//
-//  Badge.swift
-//  Landmarks
-//
-//  Created by Admin on 23.10.2020.
-//  Copyright © 2020 Apple. All rights reserved.
-//
+/*
+See LICENSE folder for this sample’s licensing information.
+
+Abstract:
+A view that displays a badge.
+*/
 
 import SwiftUI
 
@@ -14,8 +13,7 @@ struct Badge: View {
     var badgeSymbols: some View {
         ForEach(0..<Badge.rotationCount) { i in
             RotatedBadgeSymbol(
-                angle: .degrees(Double(i) / Double(Badge.rotationCount)) * 360.0
-            )
+                angle: .degrees(Double(i) / Double(Badge.rotationCount)) * 360.0)
         }
         .opacity(0.5)
     }
@@ -26,8 +24,8 @@ struct Badge: View {
             
             GeometryReader { geometry in
                 self.badgeSymbols
-                    .scaleEffect(1.0 / 4.0, anchor: .top)
-                    .position(x: geometry.size.width / 2.0, y: (3.0 / 4.0) * geometry.size.height)
+                .scaleEffect(1.0 / 4.0, anchor: .top)
+                .position(x: geometry.size.width / 2.0, y: (3.0 / 4.0) * geometry.size.height)
             }
         }
         .scaledToFit()

+ 7 - 7
Landmarks/Landmarks/BadgeBackground.swift

@@ -1,10 +1,9 @@
-//
-//  BadgeBackground.swift
-//  Landmarks
-//
-//  Created by Admin on 23.10.2020.
-//  Copyright © 2020 Apple. All rights reserved.
-//
+/*
+See LICENSE folder for this sample’s licensing information.
+
+Abstract:
+A view that displays the background of a badge.
+*/
 
 import SwiftUI
 
@@ -49,6 +48,7 @@ struct BadgeBackground: View {
                 startPoint: .init(x: 0.5, y: 0),
                 endPoint: .init(x: 0.5, y: 0.6)
             ))
+            .aspectRatio(1, contentMode: .fit)
         }
     }
     static let gradientStart = Color(red: 239.0 / 255, green: 120.0 / 255, blue: 221.0 / 255)

+ 49 - 0
Landmarks/Landmarks/Supporting Views/BadgeSymbol.swift

@@ -0,0 +1,49 @@
+/*
+See LICENSE folder for this sample’s licensing information.
+
+Abstract:
+A view that display a symbol in a badge.
+*/
+
+import SwiftUI
+
+struct BadgeSymbol: View {
+    static let symbolColor = Color(red: 79.0 / 255, green: 79.0 / 255, blue: 191.0 / 255)
+
+    var body: some View {
+        GeometryReader { geometry in
+            Path { path in
+                let width = min(geometry.size.width, geometry.size.height)
+                let height = width * 0.75
+                let spacing = width * 0.030
+                let middle = width / 2
+                let topWidth = 0.226 * width
+                let topHeight = 0.488 * height
+                
+                path.addLines([
+                    CGPoint(x: middle, y: spacing),
+                    CGPoint(x: middle - topWidth, y: topHeight - spacing),
+                    CGPoint(x: middle, y: topHeight / 2 + spacing),
+                    CGPoint(x: middle + topWidth, y: topHeight - spacing),
+                    CGPoint(x: middle, y: spacing)
+                ])
+                
+                path.move(to: CGPoint(x: middle, y: topHeight / 2 + spacing * 3))
+                path.addLines([
+                    CGPoint(x: middle - topWidth, y: topHeight + spacing),
+                    CGPoint(x: spacing, y: height - spacing),
+                    CGPoint(x: width - spacing, y: height - spacing),
+                    CGPoint(x: middle + topWidth, y: topHeight + spacing),
+                    CGPoint(x: middle, y: topHeight / 2 + spacing * 3)
+                ])
+            }
+            .fill(Self.symbolColor)
+        }
+    }
+}
+
+struct BadgeSymbol_Previews: PreviewProvider {
+    static var previews: some View {
+        BadgeSymbol()
+    }
+}

+ 36 - 0
Landmarks/Landmarks/Supporting Views/GraphCapsule.swift

@@ -0,0 +1,36 @@
+/*
+See LICENSE folder for this sample’s licensing information.
+
+Abstract:
+A single line in the graph.
+*/
+
+import SwiftUI
+
+struct GraphCapsule: View {
+    var index: Int
+    var height: CGFloat
+    var range: Range<Double>
+    var overallRange: Range<Double>
+    
+    var heightRatio: CGFloat {
+        max(CGFloat(magnitude(of: range) / magnitude(of: overallRange)), 0.15)
+    }
+    
+    var offsetRatio: CGFloat {
+        CGFloat((range.lowerBound - overallRange.lowerBound) / magnitude(of: overallRange))
+    }
+    
+    var body: some View {
+        Capsule()
+            .fill(Color.white)
+            .frame(height: height * heightRatio)
+            .offset(x: 0, y: height * -offsetRatio)
+    }
+}
+
+struct GraphCapsule_Previews: PreviewProvider {
+    static var previews: some View {
+        GraphCapsule(index: 0, height: 150, range: 10..<50, overallRange: 0..<100)
+    }
+}

+ 72 - 0
Landmarks/Landmarks/Supporting Views/HikeGraph.swift

@@ -0,0 +1,72 @@
+/*
+See LICENSE folder for this sample’s licensing information.
+
+Abstract:
+The elevation, heart rate, and pace of a hike plotted on a graph.
+*/
+
+import SwiftUI
+
+func rangeOfRanges<C: Collection>(_ ranges: C) -> Range<Double>
+    where C.Element == Range<Double> {
+    guard !ranges.isEmpty else { return 0..<0 }
+    let low = ranges.lazy.map { $0.lowerBound }.min()!
+    let high = ranges.lazy.map { $0.upperBound }.max()!
+    return low..<high
+}
+
+func magnitude(of range: Range<Double>) -> Double {
+    return range.upperBound - range.lowerBound
+}
+
+struct HikeGraph: View {
+    var hike: Hike
+    var path: KeyPath<Hike.Observation, Range<Double>>
+    
+    var color: Color {
+        switch path {
+        case \.elevation:
+            return .gray
+        case \.heartRate:
+            return Color(hue: 0, saturation: 0.5, brightness: 0.7)
+        case \.pace:
+            return Color(hue: 0.7, saturation: 0.4, brightness: 0.7)
+        default:
+            return .black
+        }
+    }
+    
+    var body: some View {
+        let data = hike.observations
+        let overallRange = rangeOfRanges(data.lazy.map { $0[keyPath: self.path] })
+        let maxMagnitude = data.map { magnitude(of: $0[keyPath: path]) }.max()!
+        let heightRatio = (1 - CGFloat(maxMagnitude / magnitude(of: overallRange))) / 2
+
+        return GeometryReader { proxy in
+            HStack(alignment: .bottom, spacing: proxy.size.width / 120) {
+                ForEach(data.indices) { index in
+                    GraphCapsule(
+                        index: index,
+                        height: proxy.size.height,
+                        range: data[index][keyPath: self.path],
+                        overallRange: overallRange)
+                    .colorMultiply(self.color)
+                }
+                .offset(x: 0, y: proxy.size.height * heightRatio)
+            }
+        }
+    }
+}
+
+struct HikeGraph_Previews: PreviewProvider {
+    static var previews: some View {
+        Group {
+            HikeGraph(hike: hikeData[0], path: \.elevation)
+                .frame(height: 200)
+            HikeGraph(hike: hikeData[0], path: \.heartRate)
+                .frame(height: 200)
+            HikeGraph(hike: hikeData[0], path: \.pace)
+                .frame(height: 200)
+        }
+    }
+}

+ 8 - 9
Landmarks/Landmarks/RotatedBadgeSymbol.swift

@@ -1,10 +1,9 @@
-//
-//  RotatedBadgeSymbol.swift
-//  Landmarks
-//
-//  Created by Admin on 23.10.2020.
-//  Copyright © 2020 Apple. All rights reserved.
-//
+/*
+See LICENSE folder for this sample’s licensing information.
+
+Abstract:
+A view that displays a rotated version of a badge symbol.
+*/
 
 import SwiftUI
 
@@ -13,8 +12,8 @@ struct RotatedBadgeSymbol: View {
     
     var body: some View {
         BadgeSymbol()
-            .padding(-60)
-            .rotationEffect(angle, anchor: .bottom)
+        .padding(-60)
+        .rotationEffect(angle, anchor: .bottom)
     }
 }
 

+ 2 - 2
README.md

@@ -1,3 +1,3 @@
-# Drawing Paths and Shapes
+# Drawing Animating Views and Transitions
 
-Use this project to code along with the [Drawing Paths and Shapes](https://developer.apple.com/tutorials/swiftui/drawing-paths-and-shapes) tutorial.
+Use this project to code along with the [Animating Views and Transitions](https://developer.apple.com/tutorials/swiftui/animating-views-and-transitions) tutorial.