feat: 初始化 Live Photo 项目结构
- 添加 PRD、技术规范、交互规范文档 (V0.2) - 创建 Swift Package 和 Xcode 项目 - 实现 LivePhotoCore 基础模块 - 添加 HEIC MakerNote 元数据写入功能 - 创建项目结构文档和任务清单 - 添加 .gitignore 忽略规则
This commit is contained in:
612
to-live-photo/to-live-photo.xcodeproj/project.pbxproj
Normal file
612
to-live-photo/to-live-photo.xcodeproj/project.pbxproj
Normal file
@@ -0,0 +1,612 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 77;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
F1A6CF932EED993E00822C1B /* LivePhotoCore in Frameworks */ = {isa = PBXBuildFile; productRef = F1A6CF922EED993E00822C1B /* LivePhotoCore */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
F1A6CF5D2EED942800822C1B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = F1A6CF472EED942500822C1B /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = F1A6CF4E2EED942500822C1B;
|
||||
remoteInfo = "to-live-photo";
|
||||
};
|
||||
F1A6CF672EED942800822C1B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = F1A6CF472EED942500822C1B /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = F1A6CF4E2EED942500822C1B;
|
||||
remoteInfo = "to-live-photo";
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
F1A6CF4F2EED942500822C1B /* to-live-photo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "to-live-photo.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
F1A6CF5C2EED942800822C1B /* to-live-photoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "to-live-photoTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
F1A6CF662EED942800822C1B /* to-live-photoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "to-live-photoUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFileSystemSynchronizedRootGroup section */
|
||||
F1A6CF512EED942500822C1B /* to-live-photo */ = {
|
||||
isa = PBXFileSystemSynchronizedRootGroup;
|
||||
path = "to-live-photo";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F1A6CF5F2EED942800822C1B /* to-live-photoTests */ = {
|
||||
isa = PBXFileSystemSynchronizedRootGroup;
|
||||
path = "to-live-photoTests";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F1A6CF692EED942800822C1B /* to-live-photoUITests */ = {
|
||||
isa = PBXFileSystemSynchronizedRootGroup;
|
||||
path = "to-live-photoUITests";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXFileSystemSynchronizedRootGroup section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
F1A6CF4C2EED942500822C1B /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F1A6CF932EED993E00822C1B /* LivePhotoCore in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
F1A6CF592EED942800822C1B /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
F1A6CF632EED942800822C1B /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
F1A6CF462EED942500822C1B = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F1A6CF512EED942500822C1B /* to-live-photo */,
|
||||
F1A6CF5F2EED942800822C1B /* to-live-photoTests */,
|
||||
F1A6CF692EED942800822C1B /* to-live-photoUITests */,
|
||||
F1A6CF502EED942500822C1B /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F1A6CF502EED942500822C1B /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F1A6CF4F2EED942500822C1B /* to-live-photo.app */,
|
||||
F1A6CF5C2EED942800822C1B /* to-live-photoTests.xctest */,
|
||||
F1A6CF662EED942800822C1B /* to-live-photoUITests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
F1A6CF4E2EED942500822C1B /* to-live-photo */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = F1A6CF702EED942800822C1B /* Build configuration list for PBXNativeTarget "to-live-photo" */;
|
||||
buildPhases = (
|
||||
F1A6CF4B2EED942500822C1B /* Sources */,
|
||||
F1A6CF4C2EED942500822C1B /* Frameworks */,
|
||||
F1A6CF4D2EED942500822C1B /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
fileSystemSynchronizedGroups = (
|
||||
F1A6CF512EED942500822C1B /* to-live-photo */,
|
||||
);
|
||||
name = "to-live-photo";
|
||||
packageProductDependencies = (
|
||||
F1A6CF922EED993E00822C1B /* LivePhotoCore */,
|
||||
);
|
||||
productName = "to-live-photo";
|
||||
productReference = F1A6CF4F2EED942500822C1B /* to-live-photo.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
F1A6CF5B2EED942800822C1B /* to-live-photoTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = F1A6CF732EED942800822C1B /* Build configuration list for PBXNativeTarget "to-live-photoTests" */;
|
||||
buildPhases = (
|
||||
F1A6CF582EED942800822C1B /* Sources */,
|
||||
F1A6CF592EED942800822C1B /* Frameworks */,
|
||||
F1A6CF5A2EED942800822C1B /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
F1A6CF5E2EED942800822C1B /* PBXTargetDependency */,
|
||||
);
|
||||
fileSystemSynchronizedGroups = (
|
||||
F1A6CF5F2EED942800822C1B /* to-live-photoTests */,
|
||||
);
|
||||
name = "to-live-photoTests";
|
||||
packageProductDependencies = (
|
||||
);
|
||||
productName = "to-live-photoTests";
|
||||
productReference = F1A6CF5C2EED942800822C1B /* to-live-photoTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
F1A6CF652EED942800822C1B /* to-live-photoUITests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = F1A6CF762EED942800822C1B /* Build configuration list for PBXNativeTarget "to-live-photoUITests" */;
|
||||
buildPhases = (
|
||||
F1A6CF622EED942800822C1B /* Sources */,
|
||||
F1A6CF632EED942800822C1B /* Frameworks */,
|
||||
F1A6CF642EED942800822C1B /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
F1A6CF682EED942800822C1B /* PBXTargetDependency */,
|
||||
);
|
||||
fileSystemSynchronizedGroups = (
|
||||
F1A6CF692EED942800822C1B /* to-live-photoUITests */,
|
||||
);
|
||||
name = "to-live-photoUITests";
|
||||
packageProductDependencies = (
|
||||
);
|
||||
productName = "to-live-photoUITests";
|
||||
productReference = F1A6CF662EED942800822C1B /* to-live-photoUITests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.ui-testing";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
F1A6CF472EED942500822C1B /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = 1;
|
||||
LastSwiftUpdateCheck = 2610;
|
||||
LastUpgradeCheck = 2610;
|
||||
TargetAttributes = {
|
||||
F1A6CF4E2EED942500822C1B = {
|
||||
CreatedOnToolsVersion = 26.1.1;
|
||||
};
|
||||
F1A6CF5B2EED942800822C1B = {
|
||||
CreatedOnToolsVersion = 26.1.1;
|
||||
TestTargetID = F1A6CF4E2EED942500822C1B;
|
||||
};
|
||||
F1A6CF652EED942800822C1B = {
|
||||
CreatedOnToolsVersion = 26.1.1;
|
||||
TestTargetID = F1A6CF4E2EED942500822C1B;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = F1A6CF4A2EED942500822C1B /* Build configuration list for PBXProject "to-live-photo" */;
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = F1A6CF462EED942500822C1B;
|
||||
minimizedProjectReferenceProxies = 1;
|
||||
packageReferences = (
|
||||
F1A6CF912EED993E00822C1B /* XCLocalSwiftPackageReference "../../to-live-photo" */,
|
||||
);
|
||||
preferredProjectObjectVersion = 77;
|
||||
productRefGroup = F1A6CF502EED942500822C1B /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
F1A6CF4E2EED942500822C1B /* to-live-photo */,
|
||||
F1A6CF5B2EED942800822C1B /* to-live-photoTests */,
|
||||
F1A6CF652EED942800822C1B /* to-live-photoUITests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
F1A6CF4D2EED942500822C1B /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
F1A6CF5A2EED942800822C1B /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
F1A6CF642EED942800822C1B /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
F1A6CF4B2EED942500822C1B /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
F1A6CF582EED942800822C1B /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
F1A6CF622EED942800822C1B /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
F1A6CF5E2EED942800822C1B /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = F1A6CF4E2EED942500822C1B /* to-live-photo */;
|
||||
targetProxy = F1A6CF5D2EED942800822C1B /* PBXContainerItemProxy */;
|
||||
};
|
||||
F1A6CF682EED942800822C1B /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = F1A6CF4E2EED942500822C1B /* to-live-photo */;
|
||||
targetProxy = F1A6CF672EED942800822C1B /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
F1A6CF6E2EED942800822C1B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEVELOPMENT_TEAM = Y976PBNGA8;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
F1A6CF6F2EED942800822C1B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEVELOPMENT_TEAM = Y976PBNGA8;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
F1A6CF712EED942800822C1B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = Y976PBNGA8;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "用于将生成的 Live Photo 保存到系统相册";
|
||||
INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "用于读取并校验已保存的 Live Photo(可选)";
|
||||
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
|
||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "xu.to-live-photo";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
STRING_CATALOG_GENERATE_SYMBOLS = YES;
|
||||
SWIFT_APPROACHABLE_CONCURRENCY = YES;
|
||||
SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
F1A6CF722EED942800822C1B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = Y976PBNGA8;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "用于将生成的 Live Photo 保存到系统相册";
|
||||
INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "用于读取并校验已保存的 Live Photo(可选)";
|
||||
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
|
||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "xu.to-live-photo";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
STRING_CATALOG_GENERATE_SYMBOLS = YES;
|
||||
SWIFT_APPROACHABLE_CONCURRENCY = YES;
|
||||
SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
F1A6CF742EED942800822C1B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = Y976PBNGA8;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "xu.to-live-photoTests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
STRING_CATALOG_GENERATE_SYMBOLS = NO;
|
||||
SWIFT_APPROACHABLE_CONCURRENCY = YES;
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/to-live-photo.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/to-live-photo";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
F1A6CF752EED942800822C1B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = Y976PBNGA8;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "xu.to-live-photoTests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
STRING_CATALOG_GENERATE_SYMBOLS = NO;
|
||||
SWIFT_APPROACHABLE_CONCURRENCY = YES;
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/to-live-photo.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/to-live-photo";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
F1A6CF772EED942800822C1B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = Y976PBNGA8;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "xu.to-live-photoUITests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
STRING_CATALOG_GENERATE_SYMBOLS = NO;
|
||||
SWIFT_APPROACHABLE_CONCURRENCY = YES;
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_TARGET_NAME = "to-live-photo";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
F1A6CF782EED942800822C1B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = Y976PBNGA8;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "xu.to-live-photoUITests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
STRING_CATALOG_GENERATE_SYMBOLS = NO;
|
||||
SWIFT_APPROACHABLE_CONCURRENCY = YES;
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_TARGET_NAME = "to-live-photo";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
F1A6CF4A2EED942500822C1B /* Build configuration list for PBXProject "to-live-photo" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
F1A6CF6E2EED942800822C1B /* Debug */,
|
||||
F1A6CF6F2EED942800822C1B /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
F1A6CF702EED942800822C1B /* Build configuration list for PBXNativeTarget "to-live-photo" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
F1A6CF712EED942800822C1B /* Debug */,
|
||||
F1A6CF722EED942800822C1B /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
F1A6CF732EED942800822C1B /* Build configuration list for PBXNativeTarget "to-live-photoTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
F1A6CF742EED942800822C1B /* Debug */,
|
||||
F1A6CF752EED942800822C1B /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
F1A6CF762EED942800822C1B /* Build configuration list for PBXNativeTarget "to-live-photoUITests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
F1A6CF772EED942800822C1B /* Debug */,
|
||||
F1A6CF782EED942800822C1B /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
|
||||
/* Begin XCLocalSwiftPackageReference section */
|
||||
F1A6CF912EED993E00822C1B /* XCLocalSwiftPackageReference "../../to-live-photo" */ = {
|
||||
isa = XCLocalSwiftPackageReference;
|
||||
relativePath = "../../to-live-photo";
|
||||
};
|
||||
/* End XCLocalSwiftPackageReference section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
F1A6CF922EED993E00822C1B /* LivePhotoCore */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
productName = LivePhotoCore;
|
||||
};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
};
|
||||
rootObject = F1A6CF472EED942500822C1B /* Project object */;
|
||||
}
|
||||
7
to-live-photo/to-live-photo.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
7
to-live-photo/to-live-photo.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
86
to-live-photo/to-live-photo/AppState.swift
Normal file
86
to-live-photo/to-live-photo/AppState.swift
Normal file
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// AppState.swift
|
||||
// to-live-photo
|
||||
//
|
||||
// App 全局状态管理 + 页面导航状态机
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import PhotosUI
|
||||
import LivePhotoCore
|
||||
|
||||
enum AppRoute: Hashable {
|
||||
case home
|
||||
case editor(videoURL: URL)
|
||||
case processing(videoURL: URL, exportParams: ExportParams)
|
||||
case result(workflowResult: LivePhotoWorkflowResult)
|
||||
case wallpaperGuide(assetId: String)
|
||||
}
|
||||
|
||||
@MainActor
|
||||
@Observable
|
||||
final class AppState {
|
||||
var navigationPath = NavigationPath()
|
||||
|
||||
var processingProgress: LivePhotoBuildProgress?
|
||||
var processingError: AppError?
|
||||
var isProcessing = false
|
||||
|
||||
private var workflow: LivePhotoWorkflow?
|
||||
|
||||
init() {
|
||||
do {
|
||||
workflow = try LivePhotoWorkflow()
|
||||
} catch {
|
||||
print("Failed to init LivePhotoWorkflow: \(error)")
|
||||
}
|
||||
}
|
||||
|
||||
func navigateTo(_ route: AppRoute) {
|
||||
navigationPath.append(route)
|
||||
}
|
||||
|
||||
func popToRoot() {
|
||||
navigationPath = NavigationPath()
|
||||
}
|
||||
|
||||
func pop() {
|
||||
if !navigationPath.isEmpty {
|
||||
navigationPath.removeLast()
|
||||
}
|
||||
}
|
||||
|
||||
func startProcessing(videoURL: URL, exportParams: ExportParams) async -> LivePhotoWorkflowResult? {
|
||||
guard let workflow else {
|
||||
processingError = AppError(code: "LPB-001", message: "初始化失败", suggestedActions: ["重启 App"])
|
||||
return nil
|
||||
}
|
||||
|
||||
isProcessing = true
|
||||
processingProgress = nil
|
||||
processingError = nil
|
||||
|
||||
do {
|
||||
let state = self
|
||||
let result = try await workflow.buildSaveValidate(
|
||||
sourceVideoURL: videoURL,
|
||||
coverImageURL: nil,
|
||||
exportParams: exportParams
|
||||
) { progress in
|
||||
Task { @MainActor in
|
||||
state.processingProgress = progress
|
||||
}
|
||||
}
|
||||
isProcessing = false
|
||||
return result
|
||||
} catch let error as AppError {
|
||||
isProcessing = false
|
||||
processingError = error
|
||||
return nil
|
||||
} catch {
|
||||
isProcessing = false
|
||||
processingError = AppError(code: "LPB-901", message: "未知错误", underlyingErrorDescription: error.localizedDescription, suggestedActions: ["重试"])
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "tinted"
|
||||
}
|
||||
],
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
40
to-live-photo/to-live-photo/ContentView.swift
Normal file
40
to-live-photo/to-live-photo/ContentView.swift
Normal file
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// ContentView.swift
|
||||
// to-live-photo
|
||||
//
|
||||
// Created by empty on 2025/12/13.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import LivePhotoCore
|
||||
|
||||
struct ContentView: View {
|
||||
@Environment(AppState.self) private var appState
|
||||
|
||||
var body: some View {
|
||||
@Bindable var appState = appState
|
||||
|
||||
NavigationStack(path: $appState.navigationPath) {
|
||||
HomeView()
|
||||
.navigationDestination(for: AppRoute.self) { route in
|
||||
switch route {
|
||||
case .home:
|
||||
HomeView()
|
||||
case .editor(let videoURL):
|
||||
EditorView(videoURL: videoURL)
|
||||
case .processing(let videoURL, let exportParams):
|
||||
ProcessingView(videoURL: videoURL, exportParams: exportParams)
|
||||
case .result(let workflowResult):
|
||||
ResultView(workflowResult: workflowResult)
|
||||
case .wallpaperGuide(let assetId):
|
||||
WallpaperGuideView(assetId: assetId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ContentView()
|
||||
.environment(AppState())
|
||||
}
|
||||
127
to-live-photo/to-live-photo/Views/EditorView.swift
Normal file
127
to-live-photo/to-live-photo/Views/EditorView.swift
Normal file
@@ -0,0 +1,127 @@
|
||||
//
|
||||
// EditorView.swift
|
||||
// to-live-photo
|
||||
//
|
||||
// 编辑页:预览视频 + 调整参数
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import AVKit
|
||||
import LivePhotoCore
|
||||
|
||||
struct EditorView: View {
|
||||
@Environment(AppState.self) private var appState
|
||||
|
||||
let videoURL: URL
|
||||
|
||||
@State private var player: AVPlayer?
|
||||
@State private var duration: Double = 1.0
|
||||
@State private var trimStart: Double = 0
|
||||
@State private var trimEnd: Double = 1.0
|
||||
@State private var keyFrameTime: Double = 0.5
|
||||
@State private var videoDuration: Double = 0
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 16) {
|
||||
if let player {
|
||||
VideoPlayer(player: player)
|
||||
.aspectRatio(9/16, contentMode: .fit)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 16))
|
||||
.padding(.horizontal)
|
||||
} else {
|
||||
RoundedRectangle(cornerRadius: 16)
|
||||
.fill(Color.secondary.opacity(0.2))
|
||||
.aspectRatio(9/16, contentMode: .fit)
|
||||
.overlay {
|
||||
ProgressView()
|
||||
}
|
||||
.padding(.horizontal)
|
||||
}
|
||||
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
HStack {
|
||||
Text("时长")
|
||||
Spacer()
|
||||
Text(String(format: "%.1f 秒", trimEnd - trimStart))
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
|
||||
Slider(value: $trimEnd, in: 1.0...max(1.0, min(1.5, videoDuration))) { _ in
|
||||
updateKeyFrameTime()
|
||||
}
|
||||
.disabled(videoDuration < 1.0)
|
||||
|
||||
Text("Live Photo 壁纸时长限制:1 ~ 1.5 秒")
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
.padding(.horizontal, 24)
|
||||
|
||||
Spacer()
|
||||
|
||||
Button {
|
||||
startProcessing()
|
||||
} label: {
|
||||
HStack {
|
||||
Image(systemName: "wand.and.stars")
|
||||
Text("生成 Live Photo")
|
||||
}
|
||||
.font(.headline)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding()
|
||||
.background(Color.accentColor)
|
||||
.foregroundColor(.white)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 14))
|
||||
}
|
||||
.padding(.horizontal, 24)
|
||||
.padding(.bottom)
|
||||
}
|
||||
.navigationTitle("编辑")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.onAppear {
|
||||
loadVideo()
|
||||
}
|
||||
.onDisappear {
|
||||
player?.pause()
|
||||
}
|
||||
}
|
||||
|
||||
private func loadVideo() {
|
||||
let asset = AVURLAsset(url: videoURL)
|
||||
Task {
|
||||
do {
|
||||
let durationCMTime = try await asset.load(.duration)
|
||||
let durationSeconds = durationCMTime.seconds
|
||||
await MainActor.run {
|
||||
videoDuration = durationSeconds
|
||||
trimEnd = min(1.0, durationSeconds) // 限制为 1 秒
|
||||
keyFrameTime = trimEnd / 2
|
||||
player = AVPlayer(url: videoURL)
|
||||
player?.play()
|
||||
}
|
||||
} catch {
|
||||
print("Failed to load video duration: \(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func updateKeyFrameTime() {
|
||||
keyFrameTime = (trimStart + trimEnd) / 2
|
||||
}
|
||||
|
||||
private func startProcessing() {
|
||||
let params = ExportParams(
|
||||
trimStart: trimStart,
|
||||
trimEnd: trimEnd,
|
||||
keyFrameTime: keyFrameTime
|
||||
)
|
||||
appState.navigateTo(.processing(videoURL: videoURL, exportParams: params))
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
EditorView(videoURL: URL(fileURLWithPath: "/tmp/test.mov"))
|
||||
}
|
||||
.environment(AppState())
|
||||
}
|
||||
125
to-live-photo/to-live-photo/Views/HomeView.swift
Normal file
125
to-live-photo/to-live-photo/Views/HomeView.swift
Normal file
@@ -0,0 +1,125 @@
|
||||
//
|
||||
// HomeView.swift
|
||||
// to-live-photo
|
||||
//
|
||||
// 首页:选择视频入口
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import PhotosUI
|
||||
import AVKit
|
||||
|
||||
struct HomeView: View {
|
||||
@Environment(AppState.self) private var appState
|
||||
@State private var selectedItem: PhotosPickerItem?
|
||||
@State private var isLoading = false
|
||||
@State private var errorMessage: String?
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 32) {
|
||||
Spacer()
|
||||
|
||||
Image(systemName: "livephoto")
|
||||
.font(.system(size: 80))
|
||||
.foregroundStyle(.tint)
|
||||
|
||||
Text("Live Photo 制作")
|
||||
.font(.largeTitle)
|
||||
.fontWeight(.bold)
|
||||
|
||||
Text("选择一段视频,将其转换为 Live Photo\n然后设置为动态锁屏壁纸")
|
||||
.font(.body)
|
||||
.foregroundStyle(.secondary)
|
||||
.multilineTextAlignment(.center)
|
||||
|
||||
Spacer()
|
||||
|
||||
PhotosPicker(
|
||||
selection: $selectedItem,
|
||||
matching: .videos,
|
||||
photoLibrary: .shared()
|
||||
) {
|
||||
HStack {
|
||||
Image(systemName: "video.badge.plus")
|
||||
Text("选择视频")
|
||||
}
|
||||
.font(.headline)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding()
|
||||
.background(Color.accentColor)
|
||||
.foregroundColor(.white)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 14))
|
||||
}
|
||||
.disabled(isLoading)
|
||||
|
||||
if isLoading {
|
||||
ProgressView("正在加载视频...")
|
||||
}
|
||||
|
||||
if let errorMessage {
|
||||
Text(errorMessage)
|
||||
.font(.caption)
|
||||
.foregroundStyle(.red)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.horizontal, 24)
|
||||
.navigationTitle("首页")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.onChange(of: selectedItem) { _, newValue in
|
||||
Task {
|
||||
await handleSelectedItem(newValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func handleSelectedItem(_ item: PhotosPickerItem?) async {
|
||||
guard let item else { return }
|
||||
|
||||
isLoading = true
|
||||
errorMessage = nil
|
||||
|
||||
do {
|
||||
guard let movie = try await item.loadTransferable(type: VideoTransferable.self) else {
|
||||
errorMessage = "无法加载视频"
|
||||
isLoading = false
|
||||
return
|
||||
}
|
||||
|
||||
isLoading = false
|
||||
appState.navigateTo(.editor(videoURL: movie.url))
|
||||
} catch {
|
||||
errorMessage = "加载失败: \(error.localizedDescription)"
|
||||
isLoading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct VideoTransferable: Transferable {
|
||||
let url: URL
|
||||
|
||||
static var transferRepresentation: some TransferRepresentation {
|
||||
FileRepresentation(contentType: .movie) { video in
|
||||
SentTransferredFile(video.url)
|
||||
} importing: { received in
|
||||
let tempDir = FileManager.default.temporaryDirectory
|
||||
let filename = "import_\(UUID().uuidString).mov"
|
||||
let destURL = tempDir.appendingPathComponent(filename)
|
||||
|
||||
if FileManager.default.fileExists(atPath: destURL.path) {
|
||||
try FileManager.default.removeItem(at: destURL)
|
||||
}
|
||||
try FileManager.default.copyItem(at: received.file, to: destURL)
|
||||
|
||||
return VideoTransferable(url: destURL)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
HomeView()
|
||||
}
|
||||
.environment(AppState())
|
||||
}
|
||||
127
to-live-photo/to-live-photo/Views/ProcessingView.swift
Normal file
127
to-live-photo/to-live-photo/Views/ProcessingView.swift
Normal file
@@ -0,0 +1,127 @@
|
||||
//
|
||||
// ProcessingView.swift
|
||||
// to-live-photo
|
||||
//
|
||||
// 生成进度页:显示处理进度
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import LivePhotoCore
|
||||
|
||||
struct ProcessingView: View {
|
||||
@Environment(AppState.self) private var appState
|
||||
|
||||
let videoURL: URL
|
||||
let exportParams: ExportParams
|
||||
|
||||
@State private var hasStarted = false
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 32) {
|
||||
Spacer()
|
||||
|
||||
if appState.processingError != nil {
|
||||
errorContent
|
||||
} else {
|
||||
progressContent
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.horizontal, 24)
|
||||
.navigationTitle("生成中")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.navigationBarBackButtonHidden(appState.isProcessing)
|
||||
.task {
|
||||
guard !hasStarted else { return }
|
||||
hasStarted = true
|
||||
await startProcessing()
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var progressContent: some View {
|
||||
ProgressView()
|
||||
.scaleEffect(1.5)
|
||||
|
||||
VStack(spacing: 8) {
|
||||
Text(stageText)
|
||||
.font(.headline)
|
||||
|
||||
if let progress = appState.processingProgress {
|
||||
Text(String(format: "%.0f%%", progress.fraction * 100))
|
||||
.font(.title2)
|
||||
.fontWeight(.bold)
|
||||
.foregroundStyle(.tint)
|
||||
}
|
||||
}
|
||||
|
||||
Text("正在生成 Live Photo,请稍候...")
|
||||
.font(.body)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var errorContent: some View {
|
||||
Image(systemName: "exclamationmark.triangle.fill")
|
||||
.font(.system(size: 60))
|
||||
.foregroundStyle(.red)
|
||||
|
||||
if let error = appState.processingError {
|
||||
VStack(spacing: 8) {
|
||||
Text("生成失败")
|
||||
.font(.headline)
|
||||
|
||||
Text(error.message)
|
||||
.font(.body)
|
||||
.foregroundStyle(.secondary)
|
||||
|
||||
if !error.suggestedActions.isEmpty {
|
||||
Text("建议:\(error.suggestedActions.joined(separator: "、"))")
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
appState.pop()
|
||||
} label: {
|
||||
Text("返回重试")
|
||||
.font(.headline)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding()
|
||||
.background(Color.accentColor)
|
||||
.foregroundColor(.white)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 14))
|
||||
}
|
||||
}
|
||||
|
||||
private var stageText: String {
|
||||
guard let stage = appState.processingProgress?.stage else {
|
||||
return "准备中..."
|
||||
}
|
||||
switch stage {
|
||||
case .normalize: return "预处理视频..."
|
||||
case .extractKeyFrame: return "提取封面帧..."
|
||||
case .writePhotoMetadata: return "写入图片元数据..."
|
||||
case .writeVideoMetadata: return "写入视频元数据..."
|
||||
case .saveToAlbum: return "保存到相册..."
|
||||
case .validate: return "校验 Live Photo..."
|
||||
}
|
||||
}
|
||||
|
||||
private func startProcessing() async {
|
||||
if let result = await appState.startProcessing(videoURL: videoURL, exportParams: exportParams) {
|
||||
appState.pop()
|
||||
appState.navigateTo(.result(workflowResult: result))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
ProcessingView(videoURL: URL(fileURLWithPath: "/tmp/test.mov"), exportParams: ExportParams())
|
||||
}
|
||||
.environment(AppState())
|
||||
}
|
||||
145
to-live-photo/to-live-photo/Views/ResultView.swift
Normal file
145
to-live-photo/to-live-photo/Views/ResultView.swift
Normal file
@@ -0,0 +1,145 @@
|
||||
//
|
||||
// ResultView.swift
|
||||
// to-live-photo
|
||||
//
|
||||
// 结果页:显示成功/失败状态与后续操作
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import LivePhotoCore
|
||||
|
||||
struct ResultView: View {
|
||||
@Environment(AppState.self) private var appState
|
||||
@State private var showShareSheet = false
|
||||
@State private var shareItems: [Any] = []
|
||||
|
||||
let workflowResult: LivePhotoWorkflowResult
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 32) {
|
||||
Spacer()
|
||||
|
||||
Image(systemName: isSuccess ? "checkmark.circle.fill" : "xmark.circle.fill")
|
||||
.font(.system(size: 80))
|
||||
.foregroundStyle(isSuccess ? .green : .red)
|
||||
|
||||
VStack(spacing: 8) {
|
||||
Text(isSuccess ? "Live Photo 已保存" : "保存失败")
|
||||
.font(.title)
|
||||
.fontWeight(.bold)
|
||||
|
||||
if isSuccess {
|
||||
Text("已保存到系统相册")
|
||||
.font(.body)
|
||||
.foregroundStyle(.secondary)
|
||||
|
||||
if workflowResult.resourceValidationOK {
|
||||
Label("资源校验通过", systemImage: "checkmark.seal.fill")
|
||||
.font(.caption)
|
||||
.foregroundStyle(.green)
|
||||
}
|
||||
|
||||
if let isLive = workflowResult.libraryAssetIsLivePhoto, isLive {
|
||||
Label("相册识别为 Live Photo", systemImage: "livephoto")
|
||||
.font(.caption)
|
||||
.foregroundStyle(.green)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
VStack(spacing: 12) {
|
||||
if isSuccess {
|
||||
Button {
|
||||
appState.navigateTo(.wallpaperGuide(assetId: workflowResult.savedAssetId))
|
||||
} label: {
|
||||
HStack {
|
||||
Image(systemName: "arrow.right.circle")
|
||||
Text("设置为动态壁纸")
|
||||
}
|
||||
.font(.headline)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding()
|
||||
.background(Color.accentColor)
|
||||
.foregroundColor(.white)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 14))
|
||||
}
|
||||
|
||||
// 调试:导出原始文件
|
||||
Button {
|
||||
prepareShareItems()
|
||||
showShareSheet = true
|
||||
} label: {
|
||||
HStack {
|
||||
Image(systemName: "square.and.arrow.up")
|
||||
Text("导出调试文件")
|
||||
}
|
||||
.font(.headline)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding()
|
||||
.background(Color.orange.opacity(0.8))
|
||||
.foregroundColor(.white)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 14))
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
appState.popToRoot()
|
||||
} label: {
|
||||
Text(isSuccess ? "继续制作" : "返回首页")
|
||||
.font(.headline)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding()
|
||||
.background(Color.secondary.opacity(0.2))
|
||||
.foregroundColor(.primary)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 14))
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 24)
|
||||
.padding(.bottom)
|
||||
}
|
||||
.navigationTitle("完成")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.navigationBarBackButtonHidden(true)
|
||||
.sheet(isPresented: $showShareSheet) {
|
||||
ShareSheet(activityItems: shareItems)
|
||||
}
|
||||
}
|
||||
|
||||
private var isSuccess: Bool {
|
||||
!workflowResult.savedAssetId.isEmpty
|
||||
}
|
||||
|
||||
private func prepareShareItems() {
|
||||
shareItems = [
|
||||
workflowResult.pairedImageURL,
|
||||
workflowResult.pairedVideoURL
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
struct ShareSheet: UIViewControllerRepresentable {
|
||||
let activityItems: [Any]
|
||||
|
||||
func makeUIViewController(context: Context) -> UIActivityViewController {
|
||||
UIActivityViewController(activityItems: activityItems, applicationActivities: nil)
|
||||
}
|
||||
|
||||
func updateUIViewController(_ uiViewController: UIActivityViewController, context: Context) {}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
ResultView(workflowResult: LivePhotoWorkflowResult(
|
||||
workId: UUID(),
|
||||
assetIdentifier: "test",
|
||||
pairedImageURL: URL(fileURLWithPath: "/tmp/photo.jpg"),
|
||||
pairedVideoURL: URL(fileURLWithPath: "/tmp/video.mov"),
|
||||
savedAssetId: "ABC123",
|
||||
resourceValidationOK: true,
|
||||
libraryAssetIsLivePhoto: true
|
||||
))
|
||||
}
|
||||
.environment(AppState())
|
||||
}
|
||||
324
to-live-photo/to-live-photo/Views/WallpaperGuideView.swift
Normal file
324
to-live-photo/to-live-photo/Views/WallpaperGuideView.swift
Normal file
@@ -0,0 +1,324 @@
|
||||
//
|
||||
// WallpaperGuideView.swift
|
||||
// to-live-photo
|
||||
//
|
||||
// 壁纸引导页:教用户如何设置动态壁纸
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct WallpaperGuideView: View {
|
||||
@Environment(AppState.self) private var appState
|
||||
|
||||
let assetId: String
|
||||
|
||||
private var iosVersion: Int {
|
||||
Int(UIDevice.current.systemVersion.split(separator: ".").first ?? "16") ?? 16
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
VStack(alignment: .leading, spacing: 24) {
|
||||
headerSection
|
||||
|
||||
quickActionSection
|
||||
|
||||
stepsSection
|
||||
|
||||
tipsSection
|
||||
|
||||
doneButton
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 16)
|
||||
}
|
||||
.navigationTitle("设置动态壁纸")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var headerSection: some View {
|
||||
VStack(alignment: .center, spacing: 12) {
|
||||
Image(systemName: "livephoto")
|
||||
.font(.system(size: 50))
|
||||
.foregroundStyle(.tint)
|
||||
.padding(.bottom, 4)
|
||||
|
||||
Text("Live Photo 已保存到相册")
|
||||
.font(.title3)
|
||||
.fontWeight(.bold)
|
||||
|
||||
if iosVersion >= 17 {
|
||||
HStack(spacing: 6) {
|
||||
Image(systemName: "checkmark.circle.fill")
|
||||
.foregroundStyle(.green)
|
||||
Text("你的设备支持锁屏动态壁纸")
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
.font(.subheadline)
|
||||
} else {
|
||||
HStack(spacing: 6) {
|
||||
Image(systemName: "exclamationmark.triangle.fill")
|
||||
.foregroundStyle(.orange)
|
||||
Text("iOS 17+ 才支持锁屏动态效果")
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
.font(.subheadline)
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.vertical, 8)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var quickActionSection: some View {
|
||||
Button {
|
||||
if let url = URL(string: "photos-redirect://") {
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
} label: {
|
||||
HStack(spacing: 12) {
|
||||
Image(systemName: "photo.on.rectangle.angled")
|
||||
.font(.title2)
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text("打开照片 App")
|
||||
.font(.headline)
|
||||
Text("找到刚保存的 Live Photo")
|
||||
.font(.caption)
|
||||
.foregroundStyle(.white.opacity(0.8))
|
||||
}
|
||||
Spacer()
|
||||
Image(systemName: "arrow.up.right.square")
|
||||
.font(.title3)
|
||||
}
|
||||
.padding(16)
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(
|
||||
LinearGradient(
|
||||
colors: [Color.blue, Color.purple],
|
||||
startPoint: .topLeading,
|
||||
endPoint: .bottomTrailing
|
||||
)
|
||||
)
|
||||
.foregroundColor(.white)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 14))
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var stepsSection: some View {
|
||||
VStack(alignment: .leading, spacing: 16) {
|
||||
HStack {
|
||||
Image(systemName: "list.number")
|
||||
.foregroundStyle(.tint)
|
||||
Text("设置壁纸步骤")
|
||||
.font(.headline)
|
||||
}
|
||||
|
||||
VStack(spacing: 0) {
|
||||
StepRow(
|
||||
number: 1,
|
||||
icon: "photo.fill",
|
||||
title: "在照片中找到 Live Photo",
|
||||
description: "照片左上角会显示【LIVE】标识,长按可预览动画效果",
|
||||
isLast: false
|
||||
)
|
||||
|
||||
StepRow(
|
||||
number: 2,
|
||||
icon: "square.and.arrow.up",
|
||||
title: "点击分享按钮",
|
||||
description: "位于屏幕左下角,然后选择【用作壁纸】选项",
|
||||
isLast: false
|
||||
)
|
||||
|
||||
StepRow(
|
||||
number: 3,
|
||||
icon: "crop",
|
||||
title: "调整照片位置",
|
||||
description: "双指缩放和拖动来调整照片在壁纸中的位置",
|
||||
isLast: false
|
||||
)
|
||||
|
||||
if iosVersion >= 17 {
|
||||
StepRow(
|
||||
number: 4,
|
||||
icon: "livephoto",
|
||||
title: "确认动态效果已开启",
|
||||
description: "点击左下角的 Live Photo 图标,图标高亮表示动态效果已开启",
|
||||
isLast: false
|
||||
)
|
||||
} else {
|
||||
StepRow(
|
||||
number: 4,
|
||||
icon: "info.circle",
|
||||
title: "了解系统限制",
|
||||
description: "iOS 16 锁屏不支持动态效果,仅主屏幕长按可播放",
|
||||
isLast: false
|
||||
)
|
||||
}
|
||||
|
||||
StepRow(
|
||||
number: 5,
|
||||
icon: "checkmark.circle",
|
||||
title: "完成设置",
|
||||
description: "点击右上角【完成】,选择【设定锁定屏幕】或【同时设定】",
|
||||
isLast: true
|
||||
)
|
||||
}
|
||||
.padding(12)
|
||||
.background(Color.secondary.opacity(0.1))
|
||||
.clipShape(RoundedRectangle(cornerRadius: 12))
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var tipsSection: some View {
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
HStack {
|
||||
Image(systemName: "questionmark.circle")
|
||||
.foregroundStyle(.tint)
|
||||
Text("常见问题")
|
||||
.font(.headline)
|
||||
}
|
||||
|
||||
FAQRow(
|
||||
icon: "magnifyingglass",
|
||||
question: "找不到刚保存的 Live Photo?",
|
||||
answer: "打开照片 App → 相簿 → 媒体类型 → 实况照片,或直接搜索【实况】"
|
||||
)
|
||||
|
||||
FAQRow(
|
||||
icon: "hand.tap",
|
||||
question: "设置后壁纸不会动?",
|
||||
answer: "锁屏状态下长按屏幕 1-2 秒可触发动画播放(需 iOS 17+)"
|
||||
)
|
||||
|
||||
FAQRow(
|
||||
icon: "battery.25",
|
||||
question: "动画效果突然失效?",
|
||||
answer: "检查是否开启了【低电量模式】,该模式下系统会自动禁用动态效果以省电"
|
||||
)
|
||||
|
||||
FAQRow(
|
||||
icon: "exclamationmark.circle",
|
||||
question: "Live Photo 图标是灰色/划线?",
|
||||
answer: "iOS 对壁纸有额外限制,部分 Live Photo 可能不支持作为动态壁纸。建议使用 2-3 秒时长、竖屏比例的视频重新生成"
|
||||
)
|
||||
|
||||
if iosVersion < 17 {
|
||||
FAQRow(
|
||||
icon: "iphone.gen3",
|
||||
question: "为什么我的锁屏没有动画?",
|
||||
answer: "iOS 16 系统限制:锁屏壁纸不支持 Live Photo 动画,建议升级到 iOS 17+"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var doneButton: some View {
|
||||
VStack(spacing: 12) {
|
||||
Button {
|
||||
appState.popToRoot()
|
||||
} label: {
|
||||
Text("完成,返回首页")
|
||||
.font(.headline)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding()
|
||||
.background(Color.accentColor)
|
||||
.foregroundColor(.white)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 14))
|
||||
}
|
||||
|
||||
Text("你可以随时制作新的 Live Photo")
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
.padding(.top, 8)
|
||||
}
|
||||
}
|
||||
|
||||
struct StepRow: View {
|
||||
let number: Int
|
||||
let icon: String
|
||||
let title: String
|
||||
let description: String
|
||||
let isLast: Bool
|
||||
|
||||
var body: some View {
|
||||
HStack(alignment: .top, spacing: 14) {
|
||||
VStack(spacing: 0) {
|
||||
ZStack {
|
||||
Circle()
|
||||
.fill(Color.accentColor)
|
||||
.frame(width: 32, height: 32)
|
||||
Text("\(number)")
|
||||
.font(.subheadline)
|
||||
.fontWeight(.bold)
|
||||
.foregroundColor(.white)
|
||||
}
|
||||
|
||||
if !isLast {
|
||||
Rectangle()
|
||||
.fill(Color.accentColor.opacity(0.3))
|
||||
.frame(width: 2)
|
||||
.frame(maxHeight: .infinity)
|
||||
}
|
||||
}
|
||||
|
||||
VStack(alignment: .leading, spacing: 6) {
|
||||
HStack(spacing: 8) {
|
||||
Image(systemName: icon)
|
||||
.font(.subheadline)
|
||||
.foregroundStyle(.tint)
|
||||
Text(title)
|
||||
.font(.subheadline)
|
||||
.fontWeight(.semibold)
|
||||
}
|
||||
|
||||
Text(description)
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
.padding(.bottom, isLast ? 0 : 16)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct FAQRow: View {
|
||||
let icon: String
|
||||
let question: String
|
||||
let answer: String
|
||||
|
||||
var body: some View {
|
||||
HStack(alignment: .top, spacing: 12) {
|
||||
Image(systemName: icon)
|
||||
.font(.title3)
|
||||
.foregroundStyle(.tint)
|
||||
.frame(width: 24)
|
||||
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
Text(question)
|
||||
.font(.subheadline)
|
||||
.fontWeight(.medium)
|
||||
Text(answer)
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
}
|
||||
.padding(14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.background(Color.secondary.opacity(0.08))
|
||||
.clipShape(RoundedRectangle(cornerRadius: 12))
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
WallpaperGuideView(assetId: "ABC123")
|
||||
}
|
||||
.environment(AppState())
|
||||
}
|
||||
20
to-live-photo/to-live-photo/to_live_photoApp.swift
Normal file
20
to-live-photo/to-live-photo/to_live_photoApp.swift
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// to_live_photoApp.swift
|
||||
// to-live-photo
|
||||
//
|
||||
// Created by empty on 2025/12/13.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
@main
|
||||
struct to_live_photoApp: App {
|
||||
@State private var appState = AppState()
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView()
|
||||
.environment(appState)
|
||||
}
|
||||
}
|
||||
}
|
||||
17
to-live-photo/to-live-photoTests/to_live_photoTests.swift
Normal file
17
to-live-photo/to-live-photoTests/to_live_photoTests.swift
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// to_live_photoTests.swift
|
||||
// to-live-photoTests
|
||||
//
|
||||
// Created by empty on 2025/12/13.
|
||||
//
|
||||
|
||||
import Testing
|
||||
@testable import to_live_photo
|
||||
|
||||
struct to_live_photoTests {
|
||||
|
||||
@Test func example() async throws {
|
||||
// Write your test here and use APIs like `#expect(...)` to check expected conditions.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// to_live_photoUITests.swift
|
||||
// to-live-photoUITests
|
||||
//
|
||||
// Created by empty on 2025/12/13.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
final class to_live_photoUITests: XCTestCase {
|
||||
|
||||
override func setUpWithError() throws {
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
|
||||
// In UI tests it is usually best to stop immediately when a failure occurs.
|
||||
continueAfterFailure = false
|
||||
|
||||
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
|
||||
}
|
||||
|
||||
override func tearDownWithError() throws {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func testExample() throws {
|
||||
// UI tests must launch the application that they test.
|
||||
let app = XCUIApplication()
|
||||
app.launch()
|
||||
|
||||
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func testLaunchPerformance() throws {
|
||||
// This measures how long it takes to launch your application.
|
||||
measure(metrics: [XCTApplicationLaunchMetric()]) {
|
||||
XCUIApplication().launch()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// to_live_photoUITestsLaunchTests.swift
|
||||
// to-live-photoUITests
|
||||
//
|
||||
// Created by empty on 2025/12/13.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
final class to_live_photoUITestsLaunchTests: XCTestCase {
|
||||
|
||||
override class var runsForEachTargetApplicationUIConfiguration: Bool {
|
||||
true
|
||||
}
|
||||
|
||||
override func setUpWithError() throws {
|
||||
continueAfterFailure = false
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func testLaunch() throws {
|
||||
let app = XCUIApplication()
|
||||
app.launch()
|
||||
|
||||
// Insert steps here to perform after app launch but before taking a screenshot,
|
||||
// such as logging into a test account or navigating somewhere in the app
|
||||
|
||||
let attachment = XCTAttachment(screenshot: app.screenshot())
|
||||
attachment.name = "Launch Screen"
|
||||
attachment.lifetime = .keepAlways
|
||||
add(attachment)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user