From 590a9f9377a628ed8fabd20cf1a57572c3c96656 Mon Sep 17 00:00:00 2001 From: Blane Townsend Date: Wed, 4 Apr 2018 17:24:08 -0500 Subject: [PATCH 1/4] Fixed Shadow Issues Shadows were being cutoff by the snapshots, and then were applied again to the snapshot. This fix first removes the shadows, takes the snapshot, and then adds the shadows to the snapshot much like the cornerRadius. --- Sources/HeroContext.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Sources/HeroContext.swift b/Sources/HeroContext.swift index c0cea003..139f72a0 100644 --- a/Sources/HeroContext.swift +++ b/Sources/HeroContext.swift @@ -138,11 +138,17 @@ extension HeroContext { unhide(view: view) - // capture a snapshot without alpha & cornerRadius + // capture a snapshot without alpha, cornerRadius, or shadows let oldCornerRadius = view.layer.cornerRadius let oldAlpha = view.alpha + let oldShadowRadius = view.layer.shadowRadius + let oldShadowOffset = view.layer.shadowOffset + let oldShadowPath = view.layer.shadowPath view.layer.cornerRadius = 0 view.alpha = 1 + view.layer.shadowRadius = 0.0 + view.layer.shadowOffset = .zero + view.layer.shadowPath = nil let snapshot: UIView let snapshotType: HeroSnapshotType = self[view]?.snapshotType ?? .optimized @@ -210,6 +216,9 @@ extension HeroContext { view.layer.cornerRadius = oldCornerRadius view.alpha = oldAlpha + view.layer.shadowRadius = oldShadowRadius + view.layer.shadowOffset = oldShadowOffset + view.layer.shadowPath = oldShadowPath snapshot.layer.anchorPoint = view.layer.anchorPoint snapshot.layer.position = containerView.convert(view.layer.position, from: view.superview!) From d9f0020dbbd7c6ceb11f3999d557cfc59cc9cda6 Mon Sep 17 00:00:00 2001 From: Blane Townsend Date: Fri, 20 Apr 2018 13:14:42 -0500 Subject: [PATCH 2/4] added shadow opacity --- Hero.xcodeproj/project.pbxproj | 30 +++++++++++++++--------------- Podfile.lock | 2 +- Sources/HeroContext.swift | 3 +++ 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/Hero.xcodeproj/project.pbxproj b/Hero.xcodeproj/project.pbxproj index 5a436a33..ab62078a 100644 --- a/Hero.xcodeproj/project.pbxproj +++ b/Hero.xcodeproj/project.pbxproj @@ -773,29 +773,29 @@ TargetAttributes = { 2D1F7FBE1E49DCB5004D944B = { CreatedOnToolsVersion = 8.2; - DevelopmentTeam = 4VSEW78TKT; + DevelopmentTeam = ZL9E38WFQ2; ProvisioningStyle = Automatic; }; 2D1F7FE11E49DD90004D944B = { CreatedOnToolsVersion = 8.2; - DevelopmentTeam = 4VSEW78TKT; + DevelopmentTeam = ZL9E38WFQ2; ProvisioningStyle = Automatic; }; A306D3B11E1C7A2E00B6C23A = { CreatedOnToolsVersion = 8.2.1; - DevelopmentTeam = 4VSEW78TKT; + DevelopmentTeam = ZL9E38WFQ2; LastSwiftMigration = 0900; ProvisioningStyle = Automatic; }; A33E60A01DE761C90065CBD8 = { CreatedOnToolsVersion = 8.0; - DevelopmentTeam = 4VSEW78TKT; + DevelopmentTeam = ZL9E38WFQ2; LastSwiftMigration = 0900; ProvisioningStyle = Automatic; }; AF1E1B501E66822C00ECE039 = { CreatedOnToolsVersion = 8.2; - DevelopmentTeam = 4VSEW78TKT; + DevelopmentTeam = ZL9E38WFQ2; LastSwiftMigration = 0900; ProvisioningStyle = Automatic; TestTargetID = A33E60A01DE761C90065CBD8; @@ -1211,7 +1211,7 @@ "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = 4VSEW78TKT; + DEVELOPMENT_TEAM = ZL9E38WFQ2; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -1237,7 +1237,7 @@ CODE_SIGN_IDENTITY = ""; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = 4VSEW78TKT; + DEVELOPMENT_TEAM = ZL9E38WFQ2; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -1263,7 +1263,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - DEVELOPMENT_TEAM = 4VSEW78TKT; + DEVELOPMENT_TEAM = ZL9E38WFQ2; INFOPLIST_FILE = TvOSExamples/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.lkzhao.HeroTvOSExamples; @@ -1282,7 +1282,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - DEVELOPMENT_TEAM = 4VSEW78TKT; + DEVELOPMENT_TEAM = ZL9E38WFQ2; INFOPLIST_FILE = TvOSExamples/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.lkzhao.HeroTvOSExamples; @@ -1303,7 +1303,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = 4VSEW78TKT; + DEVELOPMENT_TEAM = ZL9E38WFQ2; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -1330,7 +1330,7 @@ CODE_SIGN_IDENTITY = ""; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = 4VSEW78TKT; + DEVELOPMENT_TEAM = ZL9E38WFQ2; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -1464,7 +1464,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = 4VSEW78TKT; + DEVELOPMENT_TEAM = ZL9E38WFQ2; INFOPLIST_FILE = Examples/Resources/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -1482,7 +1482,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = 4VSEW78TKT; + DEVELOPMENT_TEAM = ZL9E38WFQ2; INFOPLIST_FILE = Examples/Resources/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -1498,7 +1498,7 @@ isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; - DEVELOPMENT_TEAM = 4VSEW78TKT; + DEVELOPMENT_TEAM = ZL9E38WFQ2; INFOPLIST_FILE = Tests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 10.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -1514,7 +1514,7 @@ isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; - DEVELOPMENT_TEAM = 4VSEW78TKT; + DEVELOPMENT_TEAM = ZL9E38WFQ2; INFOPLIST_FILE = Tests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 10.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; diff --git a/Podfile.lock b/Podfile.lock index e862af1c..f6216a22 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -23,4 +23,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: f1dbc884f10a7b2ddff5039dfc73e33610decc4b -COCOAPODS: 1.3.1 +COCOAPODS: 1.4.0 diff --git a/Sources/HeroContext.swift b/Sources/HeroContext.swift index 139f72a0..8246cc9b 100644 --- a/Sources/HeroContext.swift +++ b/Sources/HeroContext.swift @@ -144,11 +144,13 @@ extension HeroContext { let oldShadowRadius = view.layer.shadowRadius let oldShadowOffset = view.layer.shadowOffset let oldShadowPath = view.layer.shadowPath + let oldShadowOpacity = view.layer.shadowOpacity view.layer.cornerRadius = 0 view.alpha = 1 view.layer.shadowRadius = 0.0 view.layer.shadowOffset = .zero view.layer.shadowPath = nil + view.layer.shadowOpacity = 0.0 let snapshot: UIView let snapshotType: HeroSnapshotType = self[view]?.snapshotType ?? .optimized @@ -219,6 +221,7 @@ extension HeroContext { view.layer.shadowRadius = oldShadowRadius view.layer.shadowOffset = oldShadowOffset view.layer.shadowPath = oldShadowPath + view.layer.shadowOpacity = oldShadowOpacity snapshot.layer.anchorPoint = view.layer.anchorPoint snapshot.layer.position = containerView.convert(view.layer.position, from: view.superview!) From 063b48d55d694778348b1ee2a2136e8de7199584 Mon Sep 17 00:00:00 2001 From: Blane Townsend Date: Fri, 20 Apr 2018 13:16:42 -0500 Subject: [PATCH 3/4] Revert "added shadow opacity" This reverts commit d9f0020dbbd7c6ceb11f3999d557cfc59cc9cda6. --- Hero.xcodeproj/project.pbxproj | 30 +++++++++++++++--------------- Podfile.lock | 2 +- Sources/HeroContext.swift | 3 --- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/Hero.xcodeproj/project.pbxproj b/Hero.xcodeproj/project.pbxproj index ab62078a..5a436a33 100644 --- a/Hero.xcodeproj/project.pbxproj +++ b/Hero.xcodeproj/project.pbxproj @@ -773,29 +773,29 @@ TargetAttributes = { 2D1F7FBE1E49DCB5004D944B = { CreatedOnToolsVersion = 8.2; - DevelopmentTeam = ZL9E38WFQ2; + DevelopmentTeam = 4VSEW78TKT; ProvisioningStyle = Automatic; }; 2D1F7FE11E49DD90004D944B = { CreatedOnToolsVersion = 8.2; - DevelopmentTeam = ZL9E38WFQ2; + DevelopmentTeam = 4VSEW78TKT; ProvisioningStyle = Automatic; }; A306D3B11E1C7A2E00B6C23A = { CreatedOnToolsVersion = 8.2.1; - DevelopmentTeam = ZL9E38WFQ2; + DevelopmentTeam = 4VSEW78TKT; LastSwiftMigration = 0900; ProvisioningStyle = Automatic; }; A33E60A01DE761C90065CBD8 = { CreatedOnToolsVersion = 8.0; - DevelopmentTeam = ZL9E38WFQ2; + DevelopmentTeam = 4VSEW78TKT; LastSwiftMigration = 0900; ProvisioningStyle = Automatic; }; AF1E1B501E66822C00ECE039 = { CreatedOnToolsVersion = 8.2; - DevelopmentTeam = ZL9E38WFQ2; + DevelopmentTeam = 4VSEW78TKT; LastSwiftMigration = 0900; ProvisioningStyle = Automatic; TestTargetID = A33E60A01DE761C90065CBD8; @@ -1211,7 +1211,7 @@ "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = ZL9E38WFQ2; + DEVELOPMENT_TEAM = 4VSEW78TKT; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -1237,7 +1237,7 @@ CODE_SIGN_IDENTITY = ""; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = ZL9E38WFQ2; + DEVELOPMENT_TEAM = 4VSEW78TKT; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -1263,7 +1263,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - DEVELOPMENT_TEAM = ZL9E38WFQ2; + DEVELOPMENT_TEAM = 4VSEW78TKT; INFOPLIST_FILE = TvOSExamples/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.lkzhao.HeroTvOSExamples; @@ -1282,7 +1282,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - DEVELOPMENT_TEAM = ZL9E38WFQ2; + DEVELOPMENT_TEAM = 4VSEW78TKT; INFOPLIST_FILE = TvOSExamples/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.lkzhao.HeroTvOSExamples; @@ -1303,7 +1303,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = ZL9E38WFQ2; + DEVELOPMENT_TEAM = 4VSEW78TKT; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -1330,7 +1330,7 @@ CODE_SIGN_IDENTITY = ""; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = ZL9E38WFQ2; + DEVELOPMENT_TEAM = 4VSEW78TKT; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -1464,7 +1464,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = ZL9E38WFQ2; + DEVELOPMENT_TEAM = 4VSEW78TKT; INFOPLIST_FILE = Examples/Resources/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -1482,7 +1482,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = ZL9E38WFQ2; + DEVELOPMENT_TEAM = 4VSEW78TKT; INFOPLIST_FILE = Examples/Resources/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -1498,7 +1498,7 @@ isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; - DEVELOPMENT_TEAM = ZL9E38WFQ2; + DEVELOPMENT_TEAM = 4VSEW78TKT; INFOPLIST_FILE = Tests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 10.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -1514,7 +1514,7 @@ isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; - DEVELOPMENT_TEAM = ZL9E38WFQ2; + DEVELOPMENT_TEAM = 4VSEW78TKT; INFOPLIST_FILE = Tests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 10.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; diff --git a/Podfile.lock b/Podfile.lock index f6216a22..e862af1c 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -23,4 +23,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: f1dbc884f10a7b2ddff5039dfc73e33610decc4b -COCOAPODS: 1.4.0 +COCOAPODS: 1.3.1 diff --git a/Sources/HeroContext.swift b/Sources/HeroContext.swift index 8246cc9b..139f72a0 100644 --- a/Sources/HeroContext.swift +++ b/Sources/HeroContext.swift @@ -144,13 +144,11 @@ extension HeroContext { let oldShadowRadius = view.layer.shadowRadius let oldShadowOffset = view.layer.shadowOffset let oldShadowPath = view.layer.shadowPath - let oldShadowOpacity = view.layer.shadowOpacity view.layer.cornerRadius = 0 view.alpha = 1 view.layer.shadowRadius = 0.0 view.layer.shadowOffset = .zero view.layer.shadowPath = nil - view.layer.shadowOpacity = 0.0 let snapshot: UIView let snapshotType: HeroSnapshotType = self[view]?.snapshotType ?? .optimized @@ -221,7 +219,6 @@ extension HeroContext { view.layer.shadowRadius = oldShadowRadius view.layer.shadowOffset = oldShadowOffset view.layer.shadowPath = oldShadowPath - view.layer.shadowOpacity = oldShadowOpacity snapshot.layer.anchorPoint = view.layer.anchorPoint snapshot.layer.position = containerView.convert(view.layer.position, from: view.superview!) From 1615dea2f983d5ccdb1267bebc9cb340a9a812f0 Mon Sep 17 00:00:00 2001 From: Blane Townsend Date: Fri, 20 Apr 2018 13:20:02 -0500 Subject: [PATCH 4/4] Added/Fixed Shadow Opacity This reverts commit 590a9f9377a628ed8fabd20cf1a57572c3c96656. --- Sources/HeroContext.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sources/HeroContext.swift b/Sources/HeroContext.swift index 139f72a0..8246cc9b 100644 --- a/Sources/HeroContext.swift +++ b/Sources/HeroContext.swift @@ -144,11 +144,13 @@ extension HeroContext { let oldShadowRadius = view.layer.shadowRadius let oldShadowOffset = view.layer.shadowOffset let oldShadowPath = view.layer.shadowPath + let oldShadowOpacity = view.layer.shadowOpacity view.layer.cornerRadius = 0 view.alpha = 1 view.layer.shadowRadius = 0.0 view.layer.shadowOffset = .zero view.layer.shadowPath = nil + view.layer.shadowOpacity = 0.0 let snapshot: UIView let snapshotType: HeroSnapshotType = self[view]?.snapshotType ?? .optimized @@ -219,6 +221,7 @@ extension HeroContext { view.layer.shadowRadius = oldShadowRadius view.layer.shadowOffset = oldShadowOffset view.layer.shadowPath = oldShadowPath + view.layer.shadowOpacity = oldShadowOpacity snapshot.layer.anchorPoint = view.layer.anchorPoint snapshot.layer.position = containerView.convert(view.layer.position, from: view.superview!)