diff --git a/Note.xcodeproj/project.pbxproj b/Note.xcodeproj/project.pbxproj deleted file mode 100644 index 3c9a791..0000000 --- a/Note.xcodeproj/project.pbxproj +++ /dev/null @@ -1,356 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 77; - objects = { - -/* Begin PBXFileReference section */ - CFD3A62F30037B20001170B3 /* Note.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Note.app; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFileSystemSynchronizedRootGroup section */ - CFD3A63130037B20001170B3 /* Note */ = { - isa = PBXFileSystemSynchronizedRootGroup; - path = Note; - sourceTree = ""; - }; -/* End PBXFileSystemSynchronizedRootGroup section */ - -/* Begin PBXFrameworksBuildPhase section */ - CFD3A62C30037B20001170B3 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - CFD3A62630037B20001170B3 = { - isa = PBXGroup; - children = ( - CFD3A63130037B20001170B3 /* Note */, - CFD3A63030037B20001170B3 /* Products */, - ); - sourceTree = ""; - }; - CFD3A63030037B20001170B3 /* Products */ = { - isa = PBXGroup; - children = ( - CFD3A62F30037B20001170B3 /* Note.app */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - CFD3A62E30037B20001170B3 /* Note */ = { - isa = PBXNativeTarget; - buildConfigurationList = CFD3A63A30037B21001170B3 /* Build configuration list for PBXNativeTarget "Note" */; - buildPhases = ( - CFD3A62B30037B20001170B3 /* Sources */, - CFD3A62C30037B20001170B3 /* Frameworks */, - CFD3A62D30037B20001170B3 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - fileSystemSynchronizedGroups = ( - CFD3A63130037B20001170B3 /* Note */, - ); - name = Note; - packageProductDependencies = ( - ); - productName = Note; - productReference = CFD3A62F30037B20001170B3 /* Note.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - CFD3A62730037B20001170B3 /* Project object */ = { - isa = PBXProject; - attributes = { - BuildIndependentTargetsInParallel = 1; - LastSwiftUpdateCheck = 2630; - LastUpgradeCheck = 2630; - TargetAttributes = { - CFD3A62E30037B20001170B3 = { - CreatedOnToolsVersion = 26.3; - }; - }; - }; - buildConfigurationList = CFD3A62A30037B20001170B3 /* Build configuration list for PBXProject "Note" */; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = CFD3A62630037B20001170B3; - minimizedProjectReferenceProxies = 1; - preferredProjectObjectVersion = 77; - productRefGroup = CFD3A63030037B20001170B3 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - CFD3A62E30037B20001170B3 /* Note */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - CFD3A62D30037B20001170B3 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - CFD3A62B30037B20001170B3 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - CFD3A63830037B21001170B3 /* 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 = 37HGUEC495; - 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; - LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - CFD3A63930037B21001170B3 /* 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 = 37HGUEC495; - 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; - LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - SWIFT_COMPILATION_MODE = wholemodule; - }; - name = Release; - }; - CFD3A63B30037B21001170B3 /* 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 = 37HGUEC495; - ENABLE_APP_SANDBOX = YES; - ENABLE_HARDENED_RUNTIME = YES; - ENABLE_PREVIEWS = YES; - ENABLE_USER_SELECTED_FILES = readonly; - GENERATE_INFOPLIST_FILE = YES; - "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; - "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; - "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES; - "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES; - "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES; - "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES; - "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault; - "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = UIInterfaceOrientationPortrait; - IPHONEOS_DEPLOYMENT_TARGET = 26.0; - LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; - "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 26.0; - MARKETING_VERSION = 1.0.0; - PRODUCT_BUNDLE_IDENTIFIER = com.fishestlife.note; - PRODUCT_NAME = "$(TARGET_NAME)"; - REGISTER_APP_GROUPS = YES; - SDKROOT = auto; - STRING_CATALOG_GENERATE_SYMBOLS = YES; - SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; - 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,7"; - XROS_DEPLOYMENT_TARGET = 26.0; - }; - name = Debug; - }; - CFD3A63C30037B21001170B3 /* 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 = 37HGUEC495; - ENABLE_APP_SANDBOX = YES; - ENABLE_HARDENED_RUNTIME = YES; - ENABLE_PREVIEWS = YES; - ENABLE_USER_SELECTED_FILES = readonly; - GENERATE_INFOPLIST_FILE = YES; - "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; - "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; - "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES; - "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES; - "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES; - "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES; - "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault; - "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = UIInterfaceOrientationPortrait; - IPHONEOS_DEPLOYMENT_TARGET = 26.0; - LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; - "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 26.0; - MARKETING_VERSION = 1.0.0; - PRODUCT_BUNDLE_IDENTIFIER = com.fishestlife.note; - PRODUCT_NAME = "$(TARGET_NAME)"; - REGISTER_APP_GROUPS = YES; - SDKROOT = auto; - STRING_CATALOG_GENERATE_SYMBOLS = YES; - SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; - 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,7"; - XROS_DEPLOYMENT_TARGET = 26.0; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - CFD3A62A30037B20001170B3 /* Build configuration list for PBXProject "Note" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - CFD3A63830037B21001170B3 /* Debug */, - CFD3A63930037B21001170B3 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - CFD3A63A30037B21001170B3 /* Build configuration list for PBXNativeTarget "Note" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - CFD3A63B30037B21001170B3 /* Debug */, - CFD3A63C30037B21001170B3 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = CFD3A62730037B20001170B3 /* Project object */; -} diff --git a/Note.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Note.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a..0000000 --- a/Note.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Note/Assets.xcassets/AccentColor.colorset/Contents.json b/Note/Assets.xcassets/AccentColor.colorset/Contents.json deleted file mode 100644 index eb87897..0000000 --- a/Note/Assets.xcassets/AccentColor.colorset/Contents.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "colors" : [ - { - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Note/Assets.xcassets/AppIcon.appiconset/Contents.json b/Note/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index f3e3d37..0000000 --- a/Note/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "images" : [ - { - "filename" : "note_app_logo_appstore.png", - "idiom" : "universal", - "platform" : "ios", - "size" : "1024x1024" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "filename" : "note_app_logo_appstore 1.png", - "idiom" : "universal", - "platform" : "ios", - "size" : "1024x1024" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "tinted" - } - ], - "filename" : "note_app_logo_appstore 2.png", - "idiom" : "universal", - "platform" : "ios", - "size" : "1024x1024" - }, - { - "idiom" : "mac", - "scale" : "1x", - "size" : "16x16" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "16x16" - }, - { - "idiom" : "mac", - "scale" : "1x", - "size" : "32x32" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "32x32" - }, - { - "idiom" : "mac", - "scale" : "1x", - "size" : "128x128" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "128x128" - }, - { - "idiom" : "mac", - "scale" : "1x", - "size" : "256x256" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "256x256" - }, - { - "idiom" : "mac", - "scale" : "1x", - "size" : "512x512" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "512x512" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Note/Assets.xcassets/AppIcon.appiconset/note_app_logo_appstore 1.png b/Note/Assets.xcassets/AppIcon.appiconset/note_app_logo_appstore 1.png deleted file mode 100644 index b8e530f..0000000 Binary files a/Note/Assets.xcassets/AppIcon.appiconset/note_app_logo_appstore 1.png and /dev/null differ diff --git a/Note/Assets.xcassets/AppIcon.appiconset/note_app_logo_appstore 2.png b/Note/Assets.xcassets/AppIcon.appiconset/note_app_logo_appstore 2.png deleted file mode 100644 index b8e530f..0000000 Binary files a/Note/Assets.xcassets/AppIcon.appiconset/note_app_logo_appstore 2.png and /dev/null differ diff --git a/Note/Assets.xcassets/AppIcon.appiconset/note_app_logo_appstore.png b/Note/Assets.xcassets/AppIcon.appiconset/note_app_logo_appstore.png deleted file mode 100644 index b8e530f..0000000 Binary files a/Note/Assets.xcassets/AppIcon.appiconset/note_app_logo_appstore.png and /dev/null differ diff --git a/Note/Assets.xcassets/Contents.json b/Note/Assets.xcassets/Contents.json deleted file mode 100644 index 73c0059..0000000 --- a/Note/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Note/ContentView.swift b/Note/ContentView.swift deleted file mode 100644 index f741787..0000000 --- a/Note/ContentView.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// ContentView.swift -// Note -// -// Created by fish on 2026/7/12. -// - -import SwiftUI - -struct ContentView: View { - var body: some View { - VStack { - Image(systemName: "globe") - .imageScale(.large) - .foregroundStyle(.tint) - Text("Hello, world!") - } - .padding() - } -} - -#Preview { - ContentView() -} diff --git a/Note/FormatterView.swift b/Note/FormatterView.swift deleted file mode 100644 index d930c40..0000000 --- a/Note/FormatterView.swift +++ /dev/null @@ -1,151 +0,0 @@ -// -// FormatterView.swift -// Note -// -// Created by fish on 2026/7/12. -// - -import SwiftUI - -struct FormatterView: View { - @State private var inputText: String = "" - @State private var showEmptyAlert: Bool = false - @State private var showCopied: Bool = false - - var body: some View { - NavigationStack { - VStack(spacing: 0) { - inputArea - .frame(maxHeight: .infinity) - - actionArea - } - .background(Color(.systemGroupedBackground).ignoresSafeArea()) - .navigationTitle("文案格式化") - .navigationBarTitleDisplayMode(.large) - .toolbar { - ToolbarItem(placement: .topBarTrailing) { - MoreMenuBarButton(text: $inputText, showCopied: $showCopied) - } - } - .alert("提示", isPresented: $showEmptyAlert) { - Button("确定", role: .cancel) {} - } message: { - Text("请输入需要格式化的文案") - } - .overlay { - if showCopied { - VStack { - Spacer() - Text("已复制") - .font(.subheadline) - .padding(.horizontal, 16) - .padding(.vertical, 8) - .background(Color.black.opacity(0.75)) - .foregroundStyle(.white) - .cornerRadius(20) - .padding(.bottom, 32) - } - .transition(.opacity) - } - } - } - } - - private var inputArea: some View { - VStack(alignment: .leading, spacing: 8) { - Text("输入") - .font(.subheadline) - .foregroundStyle(.secondary) - .padding(.horizontal) - - TextEditor(text: $inputText) - .frame(maxWidth: .infinity, maxHeight: .infinity) - .padding(12) - .background(Color(.systemBackground)) - .cornerRadius(12) - .overlay( - RoundedRectangle(cornerRadius: 12) - .stroke(Color(.systemGray4), lineWidth: 1) - ) - .padding(.horizontal) - .toolbar { - ToolbarItemGroup(placement: .keyboard) { - Spacer() - Button("完成") { - dismissKeyboard() - } - } - } - - Text("粘贴需要格式化的文案") - .font(.subheadline) - .foregroundStyle(.secondary) - .padding(.horizontal) - } - .padding(.vertical, 8) - } - - private var actionArea: some View { - Button(action: formatText) { - Label("格式化", systemImage: "wand.and.stars") - .font(.headline) - .frame(maxWidth: .infinity) - .padding() - .background(Color(.systemBackground)) - .foregroundStyle(Color.accentColor) - .cornerRadius(12) - } - .padding() - .background(Color(.systemGroupedBackground)) - } - - private func dismissKeyboard() { - UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) - } - - private func formatText() { - if inputText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { - showEmptyAlert = true - return - } - - var content = inputText - - // 去 # - content = content.replacingOccurrences(of: "# ", with: "") - content = content.replacingOccurrences(of: "#", with: "") - // 将 ; 转为句号 - content = content.replacingOccurrences(of: ";", with: "。") - // 将 ; 转为句号 - content = content.replacingOccurrences(of: ";", with: "。") - // 将 . 转为句号 - content = content.replacingOccurrences(of: ".", with: "。") - // 将 ( 转为 ( - content = content.replacingOccurrences(of: "(", with: "(") - // 将 ) 转为 ) - content = content.replacingOccurrences(of: ")", with: ")") - // 将 ? 转为 ? - content = content.replacingOccurrences(of: "?", with: "?") - // 将 , 转为 , - content = content.replacingOccurrences(of: ",", with: ",") - // 将 : 转为 : - content = content.replacingOccurrences(of: ":", with: ":") - // 将 日星期 转为 日 星期 - content = content.replacingOccurrences(of: "日星期", with: "日 星期") - // 在第一行插入 # - content = "# " + content - // 标题设置 - content = content.replacingOccurrences(of: "一、生活方面", with: "## 一、生活方面") - content = content.replacingOccurrences(of: "二、交易方面", with: "## 二、交易方面") - content = content.replacingOccurrences(of: "三、工作方面", with: "## 三、工作方面") - - inputText = content - dismissKeyboard() - } - -} - -#Preview { - FormatterView() -} diff --git a/Note/MoreMenuBarButton.swift b/Note/MoreMenuBarButton.swift deleted file mode 100644 index 4caaa25..0000000 --- a/Note/MoreMenuBarButton.swift +++ /dev/null @@ -1,87 +0,0 @@ -// -// MoreMenuBarButton.swift -// Note -// -// Created by fish on 2026/7/12. -// - -import SwiftUI - -struct MoreMenuBarButton: UIViewRepresentable { - @Binding var text: String - @Binding var showCopied: Bool - - func makeUIView(context: Context) -> UIView { - let button = makeGlassButton() - button.menu = context.coordinator.makeMenu() - button.showsMenuAsPrimaryAction = true - - let barButtonItem = UIBarButtonItem(customView: button) - context.coordinator.barButtonItem = barButtonItem - context.coordinator.button = button - - return button - } - - func updateUIView(_ uiView: UIView, context: Context) { - context.coordinator.button?.menu = context.coordinator.makeMenu() - } - - func makeCoordinator() -> Coordinator { - Coordinator(self) - } - - private func makeGlassButton() -> UIButton { - let button = UIButton(type: .system) - button.setImage(UIImage(systemName: "ellipsis"), for: .normal) - button.tintColor = UIColor.label - button.frame = CGRect(x: 0, y: 0, width: 44, height: 44) - button.layer.cornerRadius = 22 - button.clipsToBounds = true - - let blurEffect = UIBlurEffect(style: .systemUltraThinMaterial) - let blurView = UIVisualEffectView(effect: blurEffect) - blurView.frame = button.bounds - blurView.autoresizingMask = [.flexibleWidth, .flexibleHeight] - blurView.isUserInteractionEnabled = false - button.insertSubview(blurView, at: 0) - - return button - } - - class Coordinator { - var parent: MoreMenuBarButton - weak var barButtonItem: UIBarButtonItem? - weak var button: UIButton? - - init(_ parent: MoreMenuBarButton) { - self.parent = parent - } - - func makeMenu() -> UIMenu { - let copyAction = UIAction( - title: "复制", - image: UIImage(systemName: "doc.on.doc"), - attributes: parent.text.isEmpty ? .disabled : [], - handler: { [weak self] _ in - UIPasteboard.general.string = self?.parent.text ?? "" - self?.parent.showCopied = true - DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) { - self?.parent.showCopied = false - } - } - ) - - let clearAction = UIAction( - title: "清除", - image: UIImage(systemName: "xmark.circle"), - attributes: parent.text.isEmpty ? [.disabled, .destructive] : .destructive, - handler: { [weak self] _ in - self?.parent.text = "" - } - ) - - return UIMenu(title: "", children: [copyAction, clearAction]) - } - } -} diff --git a/Note/NoteApp.swift b/Note/NoteApp.swift deleted file mode 100644 index 167e877..0000000 --- a/Note/NoteApp.swift +++ /dev/null @@ -1,17 +0,0 @@ -// -// NoteApp.swift -// Note -// -// Created by fish on 2026/7/12. -// - -import SwiftUI - -@main -struct NoteApp: App { - var body: some Scene { - WindowGroup { - FormatterView() - } - } -}