Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions Hero.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
B35264CF2454FEF300D33861 /* Locale+Hero.swift in Sources */ = {isa = PBXBuildFile; fileRef = B35264CD2454FEF300D33861 /* Locale+Hero.swift */; };
B383074925D1041A00B7A0D8 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B383074825D1041A00B7A0D8 /* SwiftUI.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
B383074B25D1042C00B7A0D8 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B383074A25D1042C00B7A0D8 /* SwiftUI.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
D347BDBC2ED41295009608AE /* HeroModifierInputValidationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D347BDBB2ED41295009608AE /* HeroModifierInputValidationTests.swift */; };
DBA05BB41A704A4A17967918 /* Pods_HeroTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 841FFA357ACB279D3F74CDEE /* Pods_HeroTests.framework */; };
F482F0BE235D7808002E97ED /* UIColor+HexString.swift in Sources */ = {isa = PBXBuildFile; fileRef = F482F0BD235D7808002E97ED /* UIColor+HexString.swift */; };
F482F0BF235D7808002E97ED /* UIColor+HexString.swift in Sources */ = {isa = PBXBuildFile; fileRef = F482F0BD235D7808002E97ED /* UIColor+HexString.swift */; };
Expand Down Expand Up @@ -294,6 +295,7 @@
B383074A25D1042C00B7A0D8 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS14.3.sdk/System/Library/Frameworks/SwiftUI.framework; sourceTree = DEVELOPER_DIR; };
C377744CBFF1E24426E80F55 /* Pods-HeroExamples.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HeroExamples.release.xcconfig"; path = "Pods/Target Support Files/Pods-HeroExamples/Pods-HeroExamples.release.xcconfig"; sourceTree = "<group>"; };
C51A6465EC2CB38D82F28B93 /* Pods-HeroTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HeroTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-HeroTests/Pods-HeroTests.debug.xcconfig"; sourceTree = "<group>"; };
D347BDBB2ED41295009608AE /* HeroModifierInputValidationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeroModifierInputValidationTests.swift; sourceTree = "<group>"; };
EEE340F89FF0A49DD23A5A6E /* Pods_HeroExamples.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_HeroExamples.framework; sourceTree = BUILT_PRODUCTS_DIR; };
F482F0BD235D7808002E97ED /* UIColor+HexString.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+HexString.swift"; sourceTree = "<group>"; };
F482F0C5235D7C4C002E97ED /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Main.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -590,6 +592,7 @@
AF1E1B521E66822C00ECE039 /* Tests */ = {
isa = PBXGroup;
children = (
D347BDBB2ED41295009608AE /* HeroModifierInputValidationTests.swift */,
AF1E1B531E66822C00ECE039 /* HeroTests.swift */,
AF1E1B551E66822C00ECE039 /* Info.plist */,
);
Expand Down Expand Up @@ -896,10 +899,14 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-HeroExamples/Pods-HeroExamples-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-HeroExamples/Pods-HeroExamples-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-HeroExamples/Pods-HeroExamples-frameworks.sh\"\n";
Expand Down Expand Up @@ -1126,6 +1133,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D347BDBC2ED41295009608AE /* HeroModifierInputValidationTests.swift in Sources */,
AF1E1B541E66822C00ECE039 /* HeroTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -1294,9 +1302,7 @@
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_IDENTITY = "Apple Development";
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
Expand All @@ -1305,7 +1311,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -1327,7 +1333,7 @@
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_IDENTITY = "Apple Development";
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
Expand All @@ -1336,7 +1342,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1402,7 +1408,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.6.4;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -1458,7 +1464,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.6.4;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
Expand All @@ -1477,7 +1483,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = "$(SRCROOT)/Examples/Resources/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1509,7 +1515,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = "$(SRCROOT)/Examples/Resources/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1542,7 +1548,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Tests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1576,7 +1582,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Tests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
17 changes: 15 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


target 'HeroExamples' do
platform :ios, '10.0'
platform :ios, '12.0'
use_frameworks!
pod 'CollectionKit', :inhibit_warnings => true

Expand All @@ -11,6 +11,19 @@ target 'HeroExamples' do
end

target 'HeroTvOSExamples' do
platform :tvos, '10.0'
platform :tvos, '12.0'
use_frameworks!
end

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 12.0
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
if config.build_settings['TVOS_DEPLOYMENT_TARGET'].to_f < 12.0
config.build_settings['TVOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
end
end
4 changes: 2 additions & 2 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ SPEC REPOS:
SPEC CHECKSUMS:
CollectionKit: 8f01e7629185bb81072c4aa734d105df5c2d1c8b

PODFILE CHECKSUM: 5c14933c915eeee6fbe5ecdd950d3da01c4a0a86
PODFILE CHECKSUM: 4b47eb3c33ba27c86d91d0651803ab1d0a102e64

COCOAPODS: 1.11.3
COCOAPODS: 1.16.2
46 changes: 45 additions & 1 deletion Sources/HeroModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ extension HeroModifier {
- position: position for the view to animate from/to
*/
public static func position(_ position: CGPoint) -> HeroModifier {
guard position.x.isFinite, position.y.isFinite else {
assertionFailure("Hero: Invalid position values (NaN or Infinity). Position: \(position)")
return HeroModifier { _ in }
}
return HeroModifier { targetState in
targetState.position = position
}
Expand All @@ -65,6 +69,10 @@ extension HeroModifier {
- size: size for the view to animate from/to
*/
public static func size(_ size: CGSize) -> HeroModifier {
guard size.width.isFinite, size.height.isFinite else {
assertionFailure("Hero: Invalid size values (NaN or Infinity). Size: \(size)")
return HeroModifier { _ in }
}
return HeroModifier { targetState in
targetState.size = size
}
Expand All @@ -90,6 +98,10 @@ extension HeroModifier {
- perspective: set the camera distance of the transform
*/
public static func perspective(_ perspective: CGFloat) -> HeroModifier {
guard perspective.isFinite, perspective != 0 else {
assertionFailure("Hero: Invalid perspective value (NaN, Infinity, or zero). Perspective: \(perspective)")
return HeroModifier { _ in }
}
return HeroModifier { targetState in
var transform = targetState.transform ?? CATransform3DIdentity
transform.m34 = 1.0 / -perspective
Expand All @@ -105,6 +117,10 @@ extension HeroModifier {
- z: scale factor on z axis, default 1
*/
public static func scale(x: CGFloat = 1, y: CGFloat = 1, z: CGFloat = 1) -> HeroModifier {
guard x.isFinite, y.isFinite, z.isFinite else {
assertionFailure("Hero: Invalid scale values (NaN or Infinity). x: \(x), y: \(y), z: \(z)")
return HeroModifier { _ in }
}
return HeroModifier { targetState in
targetState.transform = CATransform3DScale(targetState.transform ?? CATransform3DIdentity, x, y, z)
}
Expand All @@ -127,6 +143,10 @@ extension HeroModifier {
- z: translation distance on z axis in display pixel, default 0
*/
public static func translate(x: CGFloat = 0, y: CGFloat = 0, z: CGFloat = 0) -> HeroModifier {
guard x.isFinite, y.isFinite, z.isFinite else {
assertionFailure("Hero: Invalid translate values (NaN or Infinity). x: \(x), y: \(y), z: \(z)")
return HeroModifier { _ in }
}
return HeroModifier { targetState in
targetState.transform = CATransform3DTranslate(targetState.transform ?? CATransform3DIdentity, x, y, z)
}
Expand All @@ -144,6 +164,10 @@ extension HeroModifier {
- z: rotation on z axis in radian, default 0
*/
public static func rotate(x: CGFloat = 0, y: CGFloat = 0, z: CGFloat = 0) -> HeroModifier {
guard x.isFinite, y.isFinite, z.isFinite else {
assertionFailure("Hero: Invalid rotate values (NaN or Infinity). x: \(x), y: \(y), z: \(z)")
return HeroModifier { _ in }
}
return HeroModifier { targetState in
targetState.transform = CATransform3DRotate(targetState.transform ?? CATransform3DIdentity, x, 1, 0, 0)
targetState.transform = CATransform3DRotate(targetState.transform!, y, 0, 1, 0)
Expand Down Expand Up @@ -342,10 +366,18 @@ extension HeroModifier {
Sets the duration of the animation for a given view. If not used, Hero will use determine the duration based on the distance and size changes.
- Parameters:
- duration: duration of the animation

Note: a duration of .infinity means matching the duration of the longest animation. same as .durationMatchLongest
*/
public static func duration(_ duration: TimeInterval) -> HeroModifier {
guard duration.isFinite || duration == .infinity else {
assertionFailure("Hero: Invalid duration value (NaN). Duration: \(duration)")
return HeroModifier { _ in }
}
guard duration >= 0 else {
assertionFailure("Hero: Duration must be non-negative. Duration: \(duration)")
return HeroModifier { _ in }
}
return HeroModifier { targetState in
targetState.duration = duration
}
Expand All @@ -364,6 +396,14 @@ extension HeroModifier {
- delay: delay of the animation
*/
public static func delay(_ delay: TimeInterval) -> HeroModifier {
guard delay.isFinite else {
assertionFailure("Hero: Invalid delay value (NaN or Infinity). Delay: \(delay)")
return HeroModifier { _ in }
}
guard delay >= 0 else {
assertionFailure("Hero: Delay must be non-negative. Delay: \(delay)")
return HeroModifier { _ in }
}
return HeroModifier { targetState in
targetState.delay = delay
}
Expand Down Expand Up @@ -439,6 +479,10 @@ extension HeroModifier {
default is 1.
*/
public static func arc(intensity: CGFloat = 1) -> HeroModifier {
guard intensity.isFinite else {
assertionFailure("Hero: Invalid arc intensity value (NaN or Infinity). Intensity: \(intensity)")
return HeroModifier { _ in }
}
return HeroModifier { targetState in
targetState.arc = intensity
}
Expand Down
Loading