Skip to content

Commit

Permalink
support tvOS
Browse files Browse the repository at this point in the history
  • Loading branch information
marty-suzuki committed Jul 2, 2018
1 parent 99d81a7 commit 3bc5422
Show file tree
Hide file tree
Showing 6 changed files with 255 additions and 6 deletions.
5 changes: 3 additions & 2 deletions Sica.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ Pod::Spec.new do |s|
s.homepage = "https://github.com/cats-oss/Sica"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "funzin" => "nakazawa_fumito@abema.tv" }
s.ios.deployment_target = "9.0"
s.osx.deployment_target = "10.11"
s.ios.deployment_target = "9.0"
s.tvos.deployment_target = "10.0"
s.osx.deployment_target = "10.11"
s.source = { :git => "https://github.com/cats-oss/Sica.git", :tag => "#{s.version}" }
s.source_files = "Sica/**/*.{swift}"
s.swift_version = '4.1'
Expand Down
144 changes: 144 additions & 0 deletions Sica.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
9D436C3520E9E4DD00A1B938 /* Animator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4CB78C420AC2BDD003232F6 /* Animator.swift */; };
9D436C3620E9E4DD00A1B938 /* AnimationKeyPaths.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4CB78C520AC2BDD003232F6 /* AnimationKeyPaths.swift */; };
9D436C3920E9E4DD00A1B938 /* Sica.h in Headers */ = {isa = PBXBuildFile; fileRef = D4A60FE620ABC9890079871A /* Sica.h */; settings = {ATTRIBUTES = (Public, ); }; };
9D436C4420E9E71900A1B938 /* TimingFunction.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4CB78C620AC2BDD003232F6 /* TimingFunction.swift */; };
9D436C4520E9E71900A1B938 /* Transition.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4CB78C220AC2BDD003232F6 /* Transition.swift */; };
9D436C4620E9E71900A1B938 /* CAAnimation+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4CB78C120AC2BDD003232F6 /* CAAnimation+Extension.swift */; };
9D436C4720E9E71900A1B938 /* Animator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4CB78C420AC2BDD003232F6 /* Animator.swift */; };
9D436C4820E9E71900A1B938 /* AnimationKeyPaths.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4CB78C520AC2BDD003232F6 /* AnimationKeyPaths.swift */; };
9D436C4B20E9E71900A1B938 /* Sica.h in Headers */ = {isa = PBXBuildFile; fileRef = D4A60FE620ABC9890079871A /* Sica.h */; settings = {ATTRIBUTES = (Public, ); }; };
D4A60FED20ABC9890079871A /* Sica.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D4A60FE320ABC9890079871A /* Sica.framework */; };
D4A60FF220ABC9890079871A /* SicaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4A60FF120ABC9890079871A /* SicaTests.swift */; };
D4A60FF420ABC9890079871A /* Sica.h in Headers */ = {isa = PBXBuildFile; fileRef = D4A60FE620ABC9890079871A /* Sica.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand All @@ -36,6 +42,8 @@
/* Begin PBXFileReference section */
9D436C3F20E9E4DD00A1B938 /* Sica.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Sica.framework; sourceTree = BUILT_PRODUCTS_DIR; };
9D436C4120E9E62700A1B938 /* Info-macOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-macOS.plist"; sourceTree = "<group>"; };
9D436C5120E9E71900A1B938 /* Sica.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Sica.framework; sourceTree = BUILT_PRODUCTS_DIR; };
9D436C5320E9E73D00A1B938 /* Info-tvOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-tvOS.plist"; sourceTree = "<group>"; };
D4A60FE320ABC9890079871A /* Sica.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Sica.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D4A60FE620ABC9890079871A /* Sica.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Sica.h; sourceTree = "<group>"; };
D4A60FE720ABC9890079871A /* Info-iOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-iOS.plist"; sourceTree = "<group>"; };
Expand All @@ -57,6 +65,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
9D436C4920E9E71900A1B938 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
D4A60FDF20ABC9890079871A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
Expand All @@ -79,6 +94,7 @@
isa = PBXGroup;
children = (
D4A60FE720ABC9890079871A /* Info-iOS.plist */,
9D436C5320E9E73D00A1B938 /* Info-tvOS.plist */,
9D436C4120E9E62700A1B938 /* Info-macOS.plist */,
);
path = Resource;
Expand All @@ -99,6 +115,7 @@
D4A60FE320ABC9890079871A /* Sica.framework */,
D4A60FEC20ABC9890079871A /* SicaTests.xctest */,
9D436C3F20E9E4DD00A1B938 /* Sica.framework */,
9D436C5120E9E71900A1B938 /* Sica.framework */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -145,6 +162,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
9D436C4A20E9E71900A1B938 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
9D436C4B20E9E71900A1B938 /* Sica.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
D4A60FE020ABC9890079871A /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -175,6 +200,25 @@
productReference = 9D436C3F20E9E4DD00A1B938 /* Sica.framework */;
productType = "com.apple.product-type.framework";
};
9D436C4220E9E71900A1B938 /* Sica-tvOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 9D436C4E20E9E71900A1B938 /* Build configuration list for PBXNativeTarget "Sica-tvOS" */;
buildPhases = (
9D436C4320E9E71900A1B938 /* Sources */,
9D436C4920E9E71900A1B938 /* Frameworks */,
9D436C4A20E9E71900A1B938 /* Headers */,
9D436C4C20E9E71900A1B938 /* Resources */,
9D436C4D20E9E71900A1B938 /* ShellScript */,
);
buildRules = (
);
dependencies = (
);
name = "Sica-tvOS";
productName = AbemaAnimator;
productReference = 9D436C5120E9E71900A1B938 /* Sica.framework */;
productType = "com.apple.product-type.framework";
};
D4A60FE220ABC9890079871A /* Sica-iOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = D4A60FF720ABC9890079871A /* Build configuration list for PBXNativeTarget "Sica-iOS" */;
Expand Down Expand Up @@ -245,6 +289,7 @@
targets = (
D4A60FE220ABC9890079871A /* Sica-iOS */,
9D436C3020E9E4DD00A1B938 /* Sica-macOS */,
9D436C4220E9E71900A1B938 /* Sica-tvOS */,
D4A60FEB20ABC9890079871A /* SicaTests */,
);
};
Expand All @@ -258,6 +303,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
9D436C4C20E9E71900A1B938 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
D4A60FE120ABC9890079871A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -288,6 +340,19 @@
shellPath = /bin/sh;
shellScript = "";
};
9D436C4D20E9E71900A1B938 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "";
};
D42CFBF020BE4A4700A1A812 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -316,6 +381,18 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
9D436C4320E9E71900A1B938 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9D436C4420E9E71900A1B938 /* TimingFunction.swift in Sources */,
9D436C4520E9E71900A1B938 /* Transition.swift in Sources */,
9D436C4620E9E71900A1B938 /* CAAnimation+Extension.swift in Sources */,
9D436C4720E9E71900A1B938 /* Animator.swift in Sources */,
9D436C4820E9E71900A1B938 /* AnimationKeyPaths.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
D4A60FDE20ABC9890079871A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -405,6 +482,64 @@
};
name = Release;
};
9D436C4F20E9E71900A1B938 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Manual;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "$(SRCROOT)/Sica/Resource/Info-tvOS.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.cats-oss.sica";
PRODUCT_NAME = Sica;
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
name = Debug;
};
9D436C5020E9E71900A1B938 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Manual;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "$(SRCROOT)/Sica/Resource/Info-tvOS.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.cats-oss.sica";
PRODUCT_NAME = Sica;
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
name = Release;
};
D4A60FF520ABC9890079871A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
Expand Down Expand Up @@ -633,6 +768,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
9D436C4E20E9E71900A1B938 /* Build configuration list for PBXNativeTarget "Sica-tvOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
9D436C4F20E9E71900A1B938 /* Debug */,
9D436C5020E9E71900A1B938 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
D4A60FDD20ABC9890079871A /* Build configuration list for PBXProject "Sica" */ = {
isa = XCConfigurationList;
buildConfigurations = (
Expand Down
80 changes: 80 additions & 0 deletions Sica.xcodeproj/xcshareddata/xcschemes/Sica-tvOS.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9D436C4220E9E71900A1B938"
BuildableName = "Sica-tvOS.framework"
BlueprintName = "Sica-tvOS"
ReferencedContainer = "container:Sica.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9D436C4220E9E71900A1B938"
BuildableName = "Sica-tvOS.framework"
BlueprintName = "Sica-tvOS"
ReferencedContainer = "container:Sica.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9D436C4220E9E71900A1B938"
BuildableName = "Sica-tvOS.framework"
BlueprintName = "Sica-tvOS"
ReferencedContainer = "container:Sica.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
24 changes: 24 additions & 0 deletions Sica/Resource/Info-tvOS.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?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>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion Sica/Source/AnimationKeyPaths.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2018年 中澤 郁斗. All rights reserved.
//

#if os(iOS)
#if os(iOS) || os(tvOS)
import UIKit
#elseif os(macOS)
import AppKit
Expand Down
6 changes: 3 additions & 3 deletions Sica/Source/Animator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2018年 中澤 郁斗. All rights reserved.
//

#if os(iOS)
#if os(iOS) || os(tvOS)
import UIKit
public typealias View = UIView
#elseif os(macOS)
Expand All @@ -32,7 +32,7 @@ public final class Animator {
public let key: String

public init(view: View, forKey key: String? = nil) {
#if os(iOS)
#if os(iOS) || os(tvOS)
self.layer = view.layer
#elseif os(macOS)
view.wantsLayer = true
Expand Down Expand Up @@ -122,7 +122,7 @@ public final class Animator {
return self
}

@available(iOS 9, macOS 10.11, *)
@available(iOS 9, tvOS 10.0, macOS 10.11, *)
public func addSpringAnimation<T: AnimationValueType>(keyPath: AnimationKeyPath<T>, from: T, to: T, damping: CGFloat, mass: CGFloat, stiffness: CGFloat, initialVelocity: CGFloat, duration: Double, delay: Double = 0, timingFunction: TimingFunction = .default) -> Self {
if isCompleted { return self }
let springAnimation = CASpringAnimation(keyPath: keyPath.rawValue)
Expand Down

0 comments on commit 3bc5422

Please sign in to comment.