From 0a14378cc5421c62b87584b7c72f4043f3750f31 Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sat, 17 May 2025 00:29:08 +0800 Subject: [PATCH 01/23] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1c7bd8a..ca1aab0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# SwiftNEWKit - -### An easy way for Developers to display "What's New" for the end users. +# SwiftNEW + +![image](https://github.com/user-attachments/assets/0a5de416-f4cd-41b5-8060-f839f2e7286a) ![CleanShot 2022-06-11 at 22 54 15@2x](https://user-images.githubusercontent.com/54872601/173192927-ca2a8bef-2114-44f8-8d4d-47baadb8b4a8.png) From 47c92c3b7e67747b2b1f9ff14a3d39372260835a Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sat, 17 May 2025 00:34:25 +0800 Subject: [PATCH 02/23] Update README.md --- README.md | 52 ++++++++++++++++++++++++---------------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index ca1aab0..96612cc 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,8 @@ ![image](https://github.com/user-attachments/assets/0a5de416-f4cd-41b5-8060-f839f2e7286a) -![CleanShot 2022-06-11 at 22 54 15@2x](https://user-images.githubusercontent.com/54872601/173192927-ca2a8bef-2114-44f8-8d4d-47baadb8b4a8.png) - -## Changelog -| New (Core) Features | Version | +## Features +| Description | Version | |-----------------------------------------------------------------|-----------| | Mesh Gradient and Linear Gradient Background | 5.3.0 | | Apple visionOS & Vision Pro | 4.1.0 | @@ -21,6 +19,9 @@ | Instant Loading from Local Storage | - | ## Preview +![CleanShot 2022-06-11 at 22 54 15@2x](https://user-images.githubusercontent.com/54872601/173192927-ca2a8bef-2114-44f8-8d4d-47baadb8b4a8.png) + +## Gallery ![IMG_3472](https://user-images.githubusercontent.com/54872601/173187065-14d78119-47e7-4dcb-a3e6-c7fee4f0c67f.PNG) | ![IMG_3471](https://user-images.githubusercontent.com/54872601/173187067-fe3b5cac-54b5-4482-b73f-42e6c500546f.PNG) ------------- | ------------ Light Native | Dark Native @@ -34,7 +35,7 @@ History View (2.0.0) | App Icon (3.9.6) [Vertical / Horizontal] Support VisionOS (4.1.0 or above) | Mesh Gradient Background (5.3.0 or above) ## Example -Path: `./Demo` (Xcode Project with SwiftUI) +Path: `./Demo` (Xcode Project) ## Version ![GitHub release (latest by date)](https://img.shields.io/github/v/release/1998code/SwiftNEWKit?color=g&label=STABLE&style=for-the-badge) @@ -42,23 +43,20 @@ Path: `./Demo` (Xcode Project with SwiftUI) ![swiftui-128x128_2x](https://user-images.githubusercontent.com/54872601/173193069-2eb486b0-1347-4448-ac2b-235b8f2f1bb0.png) -## Environment -### Xcode Local +## Tested Platforms and Environment +### Local Tested on | Latest | Compatible --------- | ------ | ---------- iOS | 18.4 | > 14 iPadOS | 18.2 | > 14 macOS | 15.2 | > 11 visionOS | 2 | > 1 -### Xcode Cloud +### Cloud Tested on | Compatible --------- | ---------- Xcode | > 13.4 (13F17a) macOS | > 12.3.1 (21E258) -## Get Started -### Tutorial available on Medium: https://bit.ly/3NOvJB8 or below. - ### Setup Steps | Description | Screenshot ------| ----------- | ---------- @@ -70,7 +68,7 @@ Steps | Description | Screenshot 5R | You can use remote JSON / firebase realtime database too. | Sample: https://testground-a937f-default-rtdb.firebaseio.com/0.json?print=pretty ### Major Usage -1. Import SwiftNEWKit. +1. Import Package. ```swift import SwiftNEW ``` @@ -222,28 +220,26 @@ Copy the JSON sample to `data.json` file (If you don't have it, create a new fil ] ``` -Translation (i18n) Sample Available in v```3.9.7``` or above - -CleanShot 2023-01-02 at 17 58 49@2x +## Contributing -## Developer Note -- Please report bugs in the Issues section. -- If you want to discuss future roadmap or contribution, please find on Discussions. +Contributions to SwiftNEW are welcome! -## FAQ -Q1. Why didn’t the sheet pop up, show loading, or display a blank screen?
-A1. First, ensure that the latest version in JSON matches your app version. If you are using a local data.json file, check for any missing commas(,) or typos that could make the JSON invalid. -If you are using remote data (such as Firebase), confirm that the JSON structure is the same as the provided example.
-Q2. How can I contribute to the project?
-A2. Simply pull a request, and the admin will review your code. If everything is okay, your changes will be merged and reflected in the next minor version.
-Q3. Can I use it in Educational (include Student's Homework, Class's demo) or NGO or Commerical Projects?
-A3. YES. This project is under the license of MIT. Feel free to play it :) +- To report bugs or request features, please open an issue on GitHub +- When submitting a pull request, please follow the coding style of the project ## License -MIT + +MIT. Read the LICENSE file for details. + + ## Supported By - From 613a73c188985938960ba3fdf83380a555ffd67e Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sat, 17 May 2025 00:47:27 +0800 Subject: [PATCH 03/23] Support SwiftGlass --- Demo/What's New?.xcodeproj/project.pbxproj | 18 +-- .../xcshareddata/swiftpm/Package.resolved | 12 +- Demo/What's New?/ContentView.swift | 124 +++++------------- Demo/What's New?/What_s_New_App.swift | 3 +- Demo/What's New?/en.lproj/data.json | 22 +++- Package.swift | 10 +- Sources/SwiftNEW/SwiftNEW.swift | 36 ++--- 7 files changed, 101 insertions(+), 124 deletions(-) diff --git a/Demo/What's New?.xcodeproj/project.pbxproj b/Demo/What's New?.xcodeproj/project.pbxproj index 68d59eb..c3ce9e8 100644 --- a/Demo/What's New?.xcodeproj/project.pbxproj +++ b/Demo/What's New?.xcodeproj/project.pbxproj @@ -307,7 +307,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "What's New?/What_s_New_.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 14; + CURRENT_PROJECT_VERSION = 15; DEVELOPMENT_ASSET_PATHS = "\"What's New?/Preview Content\""; DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; @@ -317,11 +317,11 @@ "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES; "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES; INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 12.0; - MARKETING_VERSION = 5.5; + MACOSX_DEPLOYMENT_TARGET = 14.0; + MARKETING_VERSION = 6.0; PRODUCT_BUNDLE_IDENTIFIER = io.startway.WhatsNew; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; @@ -332,6 +332,7 @@ SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,7"; + XROS_DEPLOYMENT_TARGET = 1.0; }; name = Debug; }; @@ -342,7 +343,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "What's New?/What_s_New_.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 14; + CURRENT_PROJECT_VERSION = 15; DEVELOPMENT_ASSET_PATHS = "\"What's New?/Preview Content\""; DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; @@ -352,11 +353,11 @@ "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES; "INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES; INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 12.0; - MARKETING_VERSION = 5.5; + MACOSX_DEPLOYMENT_TARGET = 14.0; + MARKETING_VERSION = 6.0; PRODUCT_BUNDLE_IDENTIFIER = io.startway.WhatsNew; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; @@ -367,6 +368,7 @@ SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,7"; + XROS_DEPLOYMENT_TARGET = 1.0; }; name = Release; }; diff --git a/Demo/What's New?.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Demo/What's New?.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 72df16b..24606a2 100644 --- a/Demo/What's New?.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Demo/What's New?.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,4 +1,5 @@ { + "originHash" : "d25ed17971fd47acbfa345e11d174aae77fb3ffb8daa99aecf174631bb2053b3", "pins" : [ { "identity" : "drops", @@ -9,6 +10,15 @@ "version" : "1.7.0" } }, + { + "identity" : "swiftglass", + "kind" : "remoteSourceControl", + "location" : "https://github.com/1998code/SwiftGlass.git", + "state" : { + "revision" : "85ebac895eec35925c0821c93a83f22d796eeb8a", + "version" : "1.8.0" + } + }, { "identity" : "swiftvbkit", "kind" : "remoteSourceControl", @@ -19,5 +29,5 @@ } } ], - "version" : 2 + "version" : 3 } diff --git a/Demo/What's New?/ContentView.swift b/Demo/What's New?/ContentView.swift index 0d3311c..65da0ad 100644 --- a/Demo/What's New?/ContentView.swift +++ b/Demo/What's New?/ContentView.swift @@ -8,12 +8,40 @@ import SwiftUI import SwiftNEW -struct ContentView: View { - - @State var preview: String = "Simple" - - // MARK: All States - @State var showNew: Bool = false +#Preview("Default") { + @Previewable @State var showNew: Bool = false + SwiftNEW(show: $showNew) +} + +// Mini (Toolbar / List only) +#Preview("Invisible") { + @Previewable @State var showNew: Bool = false + List { + Section(header: Text("Compatible with Toolbar / List")) { + SwiftNEW(show: $showNew, size: .constant("mini")) + } + } +} + +#Preview("Invisible") { + @Previewable @State var showNew: Bool = false + SwiftNEW(show: $showNew, size: .constant("invisible")) +} + +// Remote (>3.0.0) - Firebase Real Time Database Demo (Compatible with json format) +#Preview("Remote") { + @Previewable @State var showNew: Bool = false + SwiftNEW(show: $showNew, labelImage: .constant("icloud"), data: .constant("https://testground-a937f-default-rtdb.firebaseio.com/.json?print=pretty")) +} + +// Drop (>3.4.0) - Recommended trigger with Remote Notification +#Preview("Drop") { + @Previewable @State var showNew: Bool = false + SwiftNEW(show: $showNew, label: .constant("Notification"), labelImage: .constant("bell.badge"), data: .constant("https://testground-a937f-default-rtdb.firebaseio.com/.json?print=pretty"), showDrop: .constant(true)) +} + +// All States +// @State var showNew: Bool = false // Optional // @State var align: HorizontalAlignment = .center // @State var color: Color = .accentColor @@ -30,87 +58,3 @@ struct ContentView: View { // @State var showDrop: Bool = false // @State var mesh: Bool = true // @State var specialEffect: String = "Christmas" - - var simple: some View { - SwiftNEW(show: $showNew) - } - - var mini: some View { - // MARK: Mini (Toolbar / List only) - List { - Section(header: Text("Compatible with Toolbar / List")) { - SwiftNEW(show: $showNew, size: .constant("mini")) - } - } - } - - var invisible: some View { - SwiftNEW(show: $showNew, size: .constant("invisible")) - } - - var remote: some View { - // MARK: Remote (>3.0.0) - Firebase Real Time Database Demo (Compatible with json format) - SwiftNEW(show: $showNew, labelImage: .constant("icloud"), data: .constant("https://testground-a937f-default-rtdb.firebaseio.com/.json?print=pretty")) - } - - var drop: some View { - // MARK: Drop (>3.4.0) - Recommended trigger with Remote Notification - SwiftNEW(show: $showNew, label: .constant("Notification"), labelImage: .constant("bell.badge"), data: .constant("https://testground-a937f-default-rtdb.firebaseio.com/.json?print=pretty"), showDrop: .constant(true)) - } - - var body: some View { - #if os(iOS) - NavigationView { - tab - } - .navigationViewStyle(.stack) - #elseif os(macOS) || os(visionOS) - tab.padding() - #endif - } - - var tab: some View { - // MARK: Choose either one size (Simple, Mini or Invisible) - TabView(selection: $preview) { - simple - .tabItem { - Label("Simple", systemImage: "textformat.size.larger") - } - .tag("Simple") - mini - .tabItem { - Label("Mini", systemImage: "textformat.size.smaller") - } - .tag("Mini") - invisible - .tabItem { - Label("Invisible", systemImage: "questionmark.square.dashed") - } - .tag("Invisible") - remote - .tabItem { - Label("Remote", systemImage: "cloud") - } - .tag("Remote") - #if os(iOS) - drop - .tabItem { - Label("Remote", systemImage: "capsule") - } - .tag("Drop") - #endif - } - .toolbar { - if preview == "Mini" { - SwiftNEW(show: $showNew, size: .constant("mini")) - } - } - .navigationTitle(preview) - } -} - -struct ContentView_Previews: PreviewProvider { - static var previews: some View { - ContentView() - } -} diff --git a/Demo/What's New?/What_s_New_App.swift b/Demo/What's New?/What_s_New_App.swift index b832626..177932e 100644 --- a/Demo/What's New?/What_s_New_App.swift +++ b/Demo/What's New?/What_s_New_App.swift @@ -11,7 +11,8 @@ import SwiftUI struct What_s_New_App: App { var body: some Scene { WindowGroup { - ContentView() +// ContentView() + Text("Demo") } } } diff --git a/Demo/What's New?/en.lproj/data.json b/Demo/What's New?/en.lproj/data.json index bc3aa9c..a4eca6f 100644 --- a/Demo/What's New?/en.lproj/data.json +++ b/Demo/What's New?/en.lproj/data.json @@ -1,13 +1,13 @@ [ { - "version": "5.5", - "subVersion": "5.5.0", + "version": "6.0", + "subVersion": "6.0.0", "new": [ { - "icon": "snowflake", - "title": "Snow", + "icon": "wineglass", + "title": "Glass", "subtitle": "Effect", - "body": "More Special Animation Coming Soon!" + "body": "Coming Soon!" }, { "icon": "macpro.gen3.server", @@ -23,6 +23,18 @@ } ] }, + { + "version": "5.5", + "subVersion": "5.5.0", + "new": [ + { + "icon": "snowflake", + "title": "Snow", + "subtitle": "Effect", + "body": "More Special Animation Coming Soon!" + } + ] + }, { "version": "5.4", "subVersion": "5.4.0", diff --git a/Package.swift b/Package.swift index 66a78ce..31bdfa0 100644 --- a/Package.swift +++ b/Package.swift @@ -12,8 +12,8 @@ let package = Package( platforms: [ .iOS(.v15), .watchOS(.v8), - .macOS(.v12), - .custom("xros", versionString: "1.0") + .macOS(.v14), + .visionOS(.v1) ], products: [ .library( @@ -22,14 +22,16 @@ let package = Package( ], dependencies: [ .package(name: "SwiftVB", url: "https://github.com/1998code/SwiftVBKit.git", .upToNextMinor(from: "1.4.0")), - .package(name: "Drops", url: "https://github.com/omaralbeik/Drops.git", .upToNextMinor(from: "1.7.0")) + .package(name: "Drops", url: "https://github.com/omaralbeik/Drops.git", .upToNextMinor(from: "1.7.0")), + .package(name: "SwiftGlass", url: "https://github.com/1998code/SwiftGlass.git", .upToNextMinor(from: "1.8.0")) ], targets: [ .target( name: "SwiftNEW", dependencies: [ "SwiftVB", - "Drops" + "Drops", + "SwiftGlass" ] ) ] diff --git a/Sources/SwiftNEW/SwiftNEW.swift b/Sources/SwiftNEW/SwiftNEW.swift index 560809e..7543432 100644 --- a/Sources/SwiftNEW/SwiftNEW.swift +++ b/Sources/SwiftNEW/SwiftNEW.swift @@ -4,6 +4,7 @@ import SwiftUI import SwiftVB +import SwiftGlass #if os(iOS) import Drops @@ -107,7 +108,7 @@ public struct SwiftNEW: View { else if size == "normal" || size == "simple" { Label(label, systemImage: labelImage) .frame(width: 300, height: 50) - #if os(iOS) && !os(xrOS) + #if os(iOS) && !os(visionOS) .foregroundColor(labelColor) .background(color) .cornerRadius(15) @@ -115,6 +116,7 @@ public struct SwiftNEW: View { } } .opacity(size == "invisible" ? 0 : 100) + .glass(shadowColor: color) .sheet(isPresented: $show) { ZStack { if mesh { @@ -132,7 +134,7 @@ public struct SwiftNEW: View { sheetHistory } } - #if os(xrOS) + #if os(visionOS) .padding() #endif } @@ -167,7 +169,7 @@ public struct SwiftNEW: View { color Image(systemName: new.icon) .foregroundColor(.white) - } + }.glass(radius: 15, shadowColor: color) .frame(width: 50, height:50) .cornerRadius(15) .padding(.trailing) @@ -186,7 +188,7 @@ public struct SwiftNEW: View { color Image(systemName: new.icon) .foregroundColor(.white) - } + }.glass(radius: 15, shadowColor: color) .frame(width: 50, height:50) .cornerRadius(15) .padding(.trailing) @@ -197,15 +199,16 @@ public struct SwiftNEW: View { } } } - if history { - showHistoryButton - } }.frame(width: 300) - // .frame(maxHeight: 450) .frame(maxHeight: UIScreen.main.bounds.height * 0.5) } Spacer() + + if history { + showHistoryButton + .padding(.bottom) + } closeCurrentButton .padding(.bottom) @@ -240,7 +243,7 @@ public struct SwiftNEW: View { } } } - #elseif os(macOS) || os(xrOS) + #elseif os(macOS) || os(visionOS) public var headings: some View { VStack { Text(String(localized: "What's New in", bundle: .module)) @@ -265,11 +268,12 @@ public struct SwiftNEW: View { } }.font(.caption) } - #if !os(xrOS) + #if !os(visionOS) .buttonStyle(.bordered) .buttonBorderShape(.capsule) .tint(.secondary) #endif + .glass(color: .secondary, shadowColor: color) } public var closeCurrentButton: some View { Button(action: { show = false }) { @@ -290,12 +294,12 @@ public struct SwiftNEW: View { #elseif os(macOS) .frame(width: 200, height: 25) #endif - #if os(iOS) && !os(xrOS) + #if os(iOS) && !os(visionOS) .foregroundColor(.white) .background(color) .cornerRadius(15) #endif - } + }.glass(shadowColor: color) } // MARK: - History List View @@ -313,9 +317,11 @@ public struct SwiftNEW: View { ZStack { color.opacity(0.25) Text(item.version).bold().font(.title2).foregroundColor(color) - }.frame(width: 75, height: 30) + }.glass(radius: 15, shadowColor: color) + .frame(width: 75, height: 30) .cornerRadius(15) .padding(.bottom) + ForEach(item.new, id: \.self) { new in HStack { if align == .leading || align == .center { @@ -323,7 +329,7 @@ public struct SwiftNEW: View { color Image(systemName: new.icon) .foregroundColor(.white) - } + }.glass(radius: 15, shadowColor: color) .frame(width: 50, height:50) .cornerRadius(15) .padding(.trailing) @@ -390,7 +396,7 @@ public struct SwiftNEW: View { .background(color) .cornerRadius(15) #endif - } + }.glass(shadowColor: color) } // MARK: - Functions From 48396f9936a1cc8d15013c916d2c2e785463e867 Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sat, 17 May 2025 01:01:47 +0800 Subject: [PATCH 04/23] Update data.json in zh and add Workflow checking --- .github/workflows/validate-json.yml | 86 ++++++++++++++++++++++++ Demo/What's New?/zh-Hans.lproj/data.json | 82 +++++----------------- Demo/What's New?/zh-Hant.lproj/data.json | 82 +++++----------------- 3 files changed, 120 insertions(+), 130 deletions(-) create mode 100644 .github/workflows/validate-json.yml diff --git a/.github/workflows/validate-json.yml b/.github/workflows/validate-json.yml new file mode 100644 index 0000000..543f6e0 --- /dev/null +++ b/.github/workflows/validate-json.yml @@ -0,0 +1,86 @@ +name: Validate JSON Files + +on: + push: + paths: + - '**/*.json' + pull_request: + paths: + - '**/*.json' + workflow_dispatch: # Allows manual triggering + +jobs: + validate-json: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Install dependencies + run: npm install -g ajv-cli ajv-formats + + - name: Create JSON schema for validation + run: | + cat > schema.json << 'EOL' + { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "array", + "items": { + "type": "object", + "required": ["version", "new"], + "properties": { + "version": { + "type": "string", + "pattern": "^\\d+\\.\\d+$|^\\d+\\.\\d+\\.\\d+$" + }, + "subVersion": { + "type": "string", + "pattern": "^\\d+\\.\\d+\\.\\d+$" + }, + "new": { + "type": "array", + "items": { + "type": "object", + "required": ["icon", "title", "subtitle", "body"], + "properties": { + "icon": { "type": "string" }, + "title": { "type": "string" }, + "subtitle": { "type": "string" }, + "body": { "type": "string" } + } + }, + "minItems": 1 + } + } + }, + "minItems": 1 + } + EOL + + - name: Find and validate data.json files + run: | + echo "Validating JSON files..." + for FILE in $(find Demo -name "data.json"); do + echo "Checking $FILE" + # Check JSON syntax + if ! jq empty "$FILE" 2>/dev/null; then + echo "❌ Invalid JSON syntax in $FILE" + exit 1 + fi + + # Validate against schema + if ! npx ajv -s schema.json -d "$FILE" --strict=false; then + echo "❌ $FILE does not match the required schema" + exit 1 + else + echo "✅ $FILE is valid" + fi + done + + echo "All JSON files are valid! 🎉" \ No newline at end of file diff --git a/Demo/What's New?/zh-Hans.lproj/data.json b/Demo/What's New?/zh-Hans.lproj/data.json index 8106c21..5b9b143 100644 --- a/Demo/What's New?/zh-Hans.lproj/data.json +++ b/Demo/What's New?/zh-Hans.lproj/data.json @@ -1,13 +1,13 @@ [ { - "version": "5.5", - "subVersion": "5.5.0", + "version": "6.0", + "subVersion": "6.0.0", "new": [ { - "icon": "snowflake", - "title": "飘雪", + "icon": "wineglass", + "title": "玻璃", "subtitle": "效果", - "body": "更多特别效果即将推出!" + "body": "即将推出!" }, { "icon": "macpro.gen3.server", @@ -23,6 +23,18 @@ } ] }, + { + "version": "5.5", + "subVersion": "5.5.0", + "new": [ + { + "icon": "snowflake", + "title": "飘雪", + "subtitle": "效果", + "body": "更多特别效果即将推出!" + } + ] + }, { "version": "5.4", "subVersion": "5.4.0", @@ -86,18 +98,6 @@ "title": "终结", "subtitle": "支援", "body": "iOS14, watchOS7, and macOS11。" - }, - { - "icon": "macpro.gen3.server", - "title": "无服务器", - "subtitle": "设计", - "body": "免费开源! ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "贡献", - "subtitle": "一起", - "body": "提出请求,变得更好! 🎉" } ] }, @@ -110,18 +110,6 @@ "title": "小型", "subtitle": "更新", "body": "一些错误修正和UI更新" - }, - { - "icon": "macpro.gen3.server", - "title": "无服务器", - "subtitle": "设计", - "body": "免费开源! ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "贡献", - "subtitle": "一起", - "body": "提出请求,变得更好! 🎉" } ] }, @@ -134,18 +122,6 @@ "title": "支持 Vision Pro", "subtitle": "和 visionOS", "body": "Drops Framework 由于冲突而被临时禁用。" - }, - { - "icon": "macpro.gen3.server", - "title": "无服务器", - "subtitle": "设计", - "body": "免费开源! ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "贡献", - "subtitle": "一起", - "body": "提出请求,变得更好! 🎉" } ] }, @@ -158,18 +134,6 @@ "title": "更好兼容性", "subtitle": "在版本和构建中", "body": "您现在可以使用 x.y.z 或 x.y。" - }, - { - "icon": "macpro.gen3.server", - "title": "无服务器", - "subtitle": "设计", - "body": "免费开源! ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "贡献", - "subtitle": "一起", - "body": "提出请求,变得更好! 🎉" } ] }, @@ -187,18 +151,6 @@ "title": "演示", "subtitle": "现在好多了", "body": "遵循包版本。" - }, - { - "icon": "macpro.gen3.server", - "title": "无服务器", - "subtitle": "设计", - "body": "免费开源! ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "贡献", - "subtitle": "一起", - "body": "提出请求,变得更好! 🎉" } ] } diff --git a/Demo/What's New?/zh-Hant.lproj/data.json b/Demo/What's New?/zh-Hant.lproj/data.json index cfd7d49..5ecdf82 100644 --- a/Demo/What's New?/zh-Hant.lproj/data.json +++ b/Demo/What's New?/zh-Hant.lproj/data.json @@ -1,13 +1,13 @@ [ { - "version": "5.5", - "subVersion": "5.5.0", + "version": "6.0", + "subVersion": "6.0.0", "new": [ { - "icon": "snowflake", - "title": "飄雪", + "icon": "wineglass", + "title": "玻璃", "subtitle": "效果", - "body": "更多特別效果即將推出!" + "body": "即將推出!" }, { "icon": "macpro.gen3.server", @@ -23,6 +23,18 @@ } ] }, + { + "version": "5.5", + "subVersion": "5.5.0", + "new": [ + { + "icon": "snowflake", + "title": "飄雪", + "subtitle": "效果", + "body": "更多特別效果即將推出!" + } + ] + }, { "version": "5.4", "subVersion": "5.4.0", @@ -86,18 +98,6 @@ "title": "終結", "subtitle": "支援", "body": "iOS14, watchOS7, and macOS11。" - }, - { - "icon": "macpro.gen3.server", - "title": "無服務器", - "subtitle": "設計", - "body": "免費開源! ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "貢獻", - "subtitle": "一起", - "body": "提出請求,變得更好! 🎉" } ] }, @@ -110,18 +110,6 @@ "title": "小型", "subtitle": "更新", "body": "一些錯誤修正和UI更新" - }, - { - "icon": "macpro.gen3.server", - "title": "無服務器", - "subtitle": "設計", - "body": "免費開源! ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "貢獻", - "subtitle": "一起", - "body": "提出請求,變得更好! 🎉" } ] }, @@ -134,18 +122,6 @@ "title": "支持 Vision Pro", "subtitle": "和 visionOS", "body": "Drops Framework 由於衝突而被臨時禁用。" - }, - { - "icon": "macpro.gen3.server", - "title": "無服務器", - "subtitle": "設計", - "body": "免費開源! ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "貢獻", - "subtitle": "一起", - "body": "提出請求,變得更好! 🎉" } ] }, @@ -158,18 +134,6 @@ "title": "更好兼容性", "subtitle": "在版本和構建中", "body": "您現在可以使用 x.y.z 或 x.y。" - }, - { - "icon": "macpro.gen3.server", - "title": "無服務器", - "subtitle": "設計", - "body": "免費開源! ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "貢獻", - "subtitle": "一起", - "body": "提出請求,變得更好! 🎉" } ] }, @@ -187,18 +151,6 @@ "title": "演示", "subtitle": "現在好多了", "body": "遵循包版本。" - }, - { - "icon": "macpro.gen3.server", - "title": "無服務器", - "subtitle": "設計", - "body": "免費開源! ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "貢獻", - "subtitle": "一起", - "body": "提出請求,變得更好! 🎉" } ] } From e11656fd2e0722a49d6cb81f55a340c92eca3bff Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sat, 17 May 2025 01:05:40 +0800 Subject: [PATCH 05/23] Update validate-json.yml --- .github/workflows/validate-json.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validate-json.yml b/.github/workflows/validate-json.yml index 543f6e0..53e65d2 100644 --- a/.github/workflows/validate-json.yml +++ b/.github/workflows/validate-json.yml @@ -66,7 +66,8 @@ jobs: - name: Find and validate data.json files run: | echo "Validating JSON files..." - for FILE in $(find Demo -name "data.json"); do + # Use -print0 and read -d '' to handle filenames with spaces properly + find Demo -name "data.json" -print0 | while IFS= read -r -d '' FILE; do echo "Checking $FILE" # Check JSON syntax if ! jq empty "$FILE" 2>/dev/null; then From 57c8c0fedb026040c255b5b7599b3fb16551e75f Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sat, 17 May 2025 01:08:57 +0800 Subject: [PATCH 06/23] Update validate-json.yml --- .github/workflows/validate-json.yml | 65 ++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 10 deletions(-) diff --git a/.github/workflows/validate-json.yml b/.github/workflows/validate-json.yml index 53e65d2..9b5ef3c 100644 --- a/.github/workflows/validate-json.yml +++ b/.github/workflows/validate-json.yml @@ -63,25 +63,70 @@ jobs: } EOL - - name: Find and validate data.json files + - name: Scan for JSON files + id: scan run: | - echo "Validating JSON files..." - # Use -print0 and read -d '' to handle filenames with spaces properly + echo "Scanning for JSON files..." + # Create a temporary file to store the list of JSON files + touch json_files.txt + + # Find all data.json files and group them by language find Demo -name "data.json" -print0 | while IFS= read -r -d '' FILE; do - echo "Checking $FILE" + # Extract the language from the directory path + LANG_DIR=$(dirname "$FILE") + LANG=$(basename "$LANG_DIR") + echo "$LANG:$FILE" >> json_files.txt + done + + echo "Found the following JSON files for validation:" + cat json_files.txt + + echo "Scan completed." + + - name: Validate JSON syntax per language + run: | + echo "Validating JSON syntax for each language..." + ERROR=0 + + # Process each file by language + while IFS=':' read -r LANG_DIR FILE || [ -n "$FILE" ]; do + echo "Checking syntax for language: $LANG_DIR - $FILE" + # Check JSON syntax if ! jq empty "$FILE" 2>/dev/null; then - echo "❌ Invalid JSON syntax in $FILE" - exit 1 + echo "❌ Invalid JSON syntax in $LANG_DIR ($FILE)" + ERROR=1 + else + echo "✅ JSON syntax is valid for $LANG_DIR" fi + done < json_files.txt + + if [ $ERROR -ne 0 ]; then + echo "JSON syntax validation failed" + exit 1 + fi + + - name: Validate schema per language + run: | + echo "Validating JSON schema for each language..." + ERROR=0 + + # Process each file by language + while IFS=':' read -r LANG_DIR FILE || [ -n "$FILE" ]; do + echo "Validating schema for language: $LANG_DIR - $FILE" # Validate against schema if ! npx ajv -s schema.json -d "$FILE" --strict=false; then - echo "❌ $FILE does not match the required schema" - exit 1 + echo "❌ $LANG_DIR ($FILE) does not match the required schema" + ERROR=1 else - echo "✅ $FILE is valid" + echo "✅ Schema is valid for $LANG_DIR" fi - done + done < json_files.txt + + if [ $ERROR -ne 0 ]; then + echo "JSON schema validation failed" + exit 1 + fi echo "All JSON files are valid! 🎉" \ No newline at end of file From 47f1b111d2c48af20070b3de2c993dd37795bf40 Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sat, 17 May 2025 01:13:46 +0800 Subject: [PATCH 07/23] Check Localization Completeness --- .github/workflows/validate-json.yml | 113 +++++++++++++++++++++++++++- 1 file changed, 112 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validate-json.yml b/.github/workflows/validate-json.yml index 9b5ef3c..c0ae666 100644 --- a/.github/workflows/validate-json.yml +++ b/.github/workflows/validate-json.yml @@ -129,4 +129,115 @@ jobs: exit 1 fi - echo "All JSON files are valid! 🎉" \ No newline at end of file + echo "All JSON files are valid! 🎉" + + check-localization-completeness: + runs-on: ubuntu-latest + needs: validate-json + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Find JSON files + id: find-json + run: | + # Create a directory to store extracted language files + mkdir -p extracted_langs + + # Find the base (en) language JSON file + BASE_FILE=$(find Demo -path "*/en.lproj/data.json" -print -quit) + if [ ! -f "$BASE_FILE" ]; then + echo "❌ Base language file (en.lproj/data.json) not found!" + exit 1 + fi + + # Find all localized JSON files + find Demo -name "data.json" | grep -v "$BASE_FILE" > localized_files.txt + + echo "Base file: $BASE_FILE" + echo "Found $(wc -l < localized_files.txt) localized files" + + - name: Check for missing versions + run: | + BASE_FILE=$(find Demo -path "*/en.lproj/data.json" -print -quit) + + # Extract version numbers from base file + jq -r '.[].version' "$BASE_FILE" | sort -V > base_versions.txt + + # Create a report file + touch localization_report.md + echo "# Localization Completeness Report" >> localization_report.md + echo "Generated on $(date)" >> localization_report.md + echo "" >> localization_report.md + + # Check each localized file + while read -r LOC_FILE; do + LANG_DIR=$(dirname "$LOC_FILE") + LANG=$(basename "$LANG_DIR" | sed 's/\.lproj//') + + echo "## Checking $LANG" >> localization_report.md + + # Extract version numbers from localized file + jq -r '.[].version' "$LOC_FILE" | sort -V > "${LANG}_versions.txt" + + # Find missing versions + MISSING_VERSIONS=$(comm -23 base_versions.txt "${LANG}_versions.txt") + + if [ -n "$MISSING_VERSIONS" ]; then + echo "❌ $LANG is missing versions: $MISSING_VERSIONS" + echo "### Missing versions:" >> localization_report.md + echo '```' >> localization_report.md + echo "$MISSING_VERSIONS" >> localization_report.md + echo '```' >> localization_report.md + echo "" >> localization_report.md + EXIT_CODE=1 + else + echo "✅ $LANG has all versions from base language" + echo "✅ All versions present" >> localization_report.md + echo "" >> localization_report.md + fi + + # Check content for each version + echo "### Content comparison:" >> localization_report.md + + while read -r VERSION; do + # Extract base data for this version + jq -r --arg v "$VERSION" '.[] | select(.version == $v)' "$BASE_FILE" > "base_${VERSION}.json" + jq -r --arg v "$VERSION" '.[] | select(.version == $v)' "$LOC_FILE" > "${LANG}_${VERSION}.json" + + if [ -s "${LANG}_${VERSION}.json" ]; then + # Count items in the "new" array for base and localized + BASE_ITEMS=$(jq -r '.new | length' "base_${VERSION}.json") + LOC_ITEMS=$(jq -r '.new | length' "${LANG}_${VERSION}.json") + + if [ "$BASE_ITEMS" -ne "$LOC_ITEMS" ]; then + echo "❌ $LANG version $VERSION has $LOC_ITEMS items (base has $BASE_ITEMS)" + echo "- Version $VERSION: $LOC_ITEMS/$BASE_ITEMS items ❌" >> localization_report.md + EXIT_CODE=1 + else + echo "✅ $LANG version $VERSION has all $BASE_ITEMS items" + echo "- Version $VERSION: $LOC_ITEMS/$BASE_ITEMS items ✅" >> localization_report.md + fi + fi + done < base_versions.txt + + echo "" >> localization_report.md + done < localized_files.txt + + cat localization_report.md + + # Exit with the accumulated status + if [ "$EXIT_CODE" -eq 1 ]; then + echo "❌ Localization check failed - some languages are missing versions or items" + exit 1 + else + echo "✅ All languages have complete translations" + fi + + - name: Upload Localization Report + if: always() + uses: actions/upload-artifact@v3 + with: + name: localization-report + path: localization_report.md \ No newline at end of file From 22b20bfadba1e4889ea584b945a8504f1b51949f Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sat, 17 May 2025 01:21:31 +0800 Subject: [PATCH 08/23] Update validate-json.yml --- .github/workflows/validate-json.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate-json.yml b/.github/workflows/validate-json.yml index c0ae666..c8bf6f3 100644 --- a/.github/workflows/validate-json.yml +++ b/.github/workflows/validate-json.yml @@ -237,7 +237,7 @@ jobs: - name: Upload Localization Report if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: localization-report path: localization_report.md \ No newline at end of file From 5c13366d90862aea12898fa03184eb0113813dcf Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sat, 17 May 2025 01:23:51 +0800 Subject: [PATCH 09/23] Update data.json --- Demo/What's New?/zh-Hant.lproj/data.json | 121 +++++++++++++++++++++++ 1 file changed, 121 insertions(+) diff --git a/Demo/What's New?/zh-Hant.lproj/data.json b/Demo/What's New?/zh-Hant.lproj/data.json index 5ecdf82..8ac70f4 100644 --- a/Demo/What's New?/zh-Hant.lproj/data.json +++ b/Demo/What's New?/zh-Hant.lproj/data.json @@ -153,5 +153,126 @@ "body": "遵循包版本。" } ] + }, + { + "version": "1.5", + "new": [ + { + "icon": "hammer", + "title": "Layout", + "subtitle": "Fixed", + "body": "on iOS Landscape." + }, + { + "icon": "macpro.gen3.server", + "title": "Serverless", + "subtitle": "Design", + "body": "Free and open source! Created by Ming with ❤️‍🔥" + }, + { + "icon": "arrow.triangle.pull", + "title": "Contribute", + "subtitle": "Together", + "body": "Pull requests and make it better for everyone!" + } + ] + }, + { + "version": "1.4", + "new": [ + { + "icon": "hammer", + "title": "Crash", + "subtitle": "Fixed", + "body": "on macOS." + }, + { + "icon": "macpro.gen3.server", + "title": "Serverless", + "subtitle": "Design", + "body": "Free and open source! Created by Ming with ❤️‍🔥" + }, + { + "icon": "arrow.triangle.pull", + "title": "Contribute", + "subtitle": "Together", + "body": "Pull requests and make it better for everyone!" + } + ] + }, + { + "version": "1.3", + "new": [ + { + "icon": "bell.badge", + "title": "Remote Drop", + "subtitle": "Supported", + "body": "Instead of full page sheet, you can use a small drop too!" + }, + { + "icon": "macpro.gen3.server", + "title": "Serverless", + "subtitle": "Design", + "body": "Free and open source! Created by Ming with ❤️‍🔥" + }, + { + "icon": "arrow.triangle.pull", + "title": "Contribute", + "subtitle": "Together", + "body": "Pull requests and make it better for everyone!" + } + ] + }, + { + "version": "1.2", + "new": [ + { + "icon": "square.and.arrow.down.fill", + "title": "Remote File", + "subtitle": "Supported", + "body": "Direct load via remote storage. Easy!" + }, + { + "icon": "macpro.gen3.server", + "title": "Serverless", + "subtitle": "Design", + "body": "Free and open source! Created by Ming with ❤️‍🔥" + }, + { + "icon": "arrow.triangle.pull", + "title": "Contribute", + "subtitle": "Together", + "body": "Pull requests and make it better for everyone!" + } + ] + }, + { + "version": "1.1", + "new": [ + { + "icon": "hammer.fill", + "title": "Bug fixes", + "subtitle": "Broken UI", + "body": "Available for iOS 16, iPadOS 16, macOS 13" + }, + { + "icon": "square.and.arrow.down.fill", + "title": "Local File", + "subtitle": "Supported", + "body": "Direct load via local storage. Super fast!" + }, + { + "icon": "macpro.gen3.server", + "title": "Serverless", + "subtitle": "Design", + "body": "Free and open source! Created by Ming with ❤️‍🔥" + }, + { + "icon": "arrow.triangle.pull", + "title": "Contribute", + "subtitle": "Together", + "body": "Pull requests and make it better for everyone!" + } + ] } ] From 8d7296b83a74e0a09f6d31459d1927422cfb5b72 Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sat, 17 May 2025 01:24:03 +0800 Subject: [PATCH 10/23] Update data.json --- Demo/What's New?/zh-Hans.lproj/data.json | 121 +++++++++++++++++++++++ 1 file changed, 121 insertions(+) diff --git a/Demo/What's New?/zh-Hans.lproj/data.json b/Demo/What's New?/zh-Hans.lproj/data.json index 5b9b143..a1ba236 100644 --- a/Demo/What's New?/zh-Hans.lproj/data.json +++ b/Demo/What's New?/zh-Hans.lproj/data.json @@ -153,5 +153,126 @@ "body": "遵循包版本。" } ] + }, + { + "version": "1.5", + "new": [ + { + "icon": "hammer", + "title": "Layout", + "subtitle": "Fixed", + "body": "on iOS Landscape." + }, + { + "icon": "macpro.gen3.server", + "title": "Serverless", + "subtitle": "Design", + "body": "Free and open source! Created by Ming with ❤️‍🔥" + }, + { + "icon": "arrow.triangle.pull", + "title": "Contribute", + "subtitle": "Together", + "body": "Pull requests and make it better for everyone!" + } + ] + }, + { + "version": "1.4", + "new": [ + { + "icon": "hammer", + "title": "Crash", + "subtitle": "Fixed", + "body": "on macOS." + }, + { + "icon": "macpro.gen3.server", + "title": "Serverless", + "subtitle": "Design", + "body": "Free and open source! Created by Ming with ❤️‍🔥" + }, + { + "icon": "arrow.triangle.pull", + "title": "Contribute", + "subtitle": "Together", + "body": "Pull requests and make it better for everyone!" + } + ] + }, + { + "version": "1.3", + "new": [ + { + "icon": "bell.badge", + "title": "Remote Drop", + "subtitle": "Supported", + "body": "Instead of full page sheet, you can use a small drop too!" + }, + { + "icon": "macpro.gen3.server", + "title": "Serverless", + "subtitle": "Design", + "body": "Free and open source! Created by Ming with ❤️‍🔥" + }, + { + "icon": "arrow.triangle.pull", + "title": "Contribute", + "subtitle": "Together", + "body": "Pull requests and make it better for everyone!" + } + ] + }, + { + "version": "1.2", + "new": [ + { + "icon": "square.and.arrow.down.fill", + "title": "Remote File", + "subtitle": "Supported", + "body": "Direct load via remote storage. Easy!" + }, + { + "icon": "macpro.gen3.server", + "title": "Serverless", + "subtitle": "Design", + "body": "Free and open source! Created by Ming with ❤️‍🔥" + }, + { + "icon": "arrow.triangle.pull", + "title": "Contribute", + "subtitle": "Together", + "body": "Pull requests and make it better for everyone!" + } + ] + }, + { + "version": "1.1", + "new": [ + { + "icon": "hammer.fill", + "title": "Bug fixes", + "subtitle": "Broken UI", + "body": "Available for iOS 16, iPadOS 16, macOS 13" + }, + { + "icon": "square.and.arrow.down.fill", + "title": "Local File", + "subtitle": "Supported", + "body": "Direct load via local storage. Super fast!" + }, + { + "icon": "macpro.gen3.server", + "title": "Serverless", + "subtitle": "Design", + "body": "Free and open source! Created by Ming with ❤️‍🔥" + }, + { + "icon": "arrow.triangle.pull", + "title": "Contribute", + "subtitle": "Together", + "body": "Pull requests and make it better for everyone!" + } + ] } ] From e0a8d152d0e07ae0cabda0685b250bc681a47141 Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sat, 17 May 2025 14:04:02 +0800 Subject: [PATCH 11/23] Update Package.resolved --- Package.resolved | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Package.resolved b/Package.resolved index 72df16b..262633c 100644 --- a/Package.resolved +++ b/Package.resolved @@ -9,6 +9,15 @@ "version" : "1.7.0" } }, + { + "identity" : "swiftglass", + "kind" : "remoteSourceControl", + "location" : "https://github.com/1998code/SwiftGlass.git", + "state" : { + "revision" : "85ebac895eec35925c0821c93a83f22d796eeb8a", + "version" : "1.8.0" + } + }, { "identity" : "swiftvbkit", "kind" : "remoteSourceControl", From 0ba3fe7cd2bd85f1c26a0f853a838f74be19a8ed Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sat, 17 May 2025 14:23:19 +0800 Subject: [PATCH 12/23] Delete SwiftNEWTests.swift --- Tests/SwiftNEWTests/SwiftNEWTests.swift | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 Tests/SwiftNEWTests/SwiftNEWTests.swift diff --git a/Tests/SwiftNEWTests/SwiftNEWTests.swift b/Tests/SwiftNEWTests/SwiftNEWTests.swift deleted file mode 100644 index 9c6bd93..0000000 --- a/Tests/SwiftNEWTests/SwiftNEWTests.swift +++ /dev/null @@ -1,15 +0,0 @@ -// -// Created by Ming on 11/6/2022. -// - -import XCTest -@testable import SwiftNEW - -final class SwiftNEWTests: XCTestCase { - func testExample() throws { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct - // results. -// XCTAssertEqual(SwiftNEW().text, "Hello, World!") - } -} From 8a8014ddfad363dfc98536fb572b2ae83e06ada9 Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sat, 17 May 2025 14:57:39 +0800 Subject: [PATCH 13/23] Readme in multi-languages --- README.md | 4 +- README/README_hc.md | 244 ++++++++++++++++++++++++++++++++++++++++++++ README/README_ja.md | 244 ++++++++++++++++++++++++++++++++++++++++++++ README/README_ko.md | 244 ++++++++++++++++++++++++++++++++++++++++++++ README/README_tc.md | 244 ++++++++++++++++++++++++++++++++++++++++++++ README/README_zh.md | 244 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 1222 insertions(+), 2 deletions(-) create mode 100644 README/README_hc.md create mode 100644 README/README_ja.md create mode 100644 README/README_ko.md create mode 100644 README/README_tc.md create mode 100644 README/README_zh.md diff --git a/README.md b/README.md index 96612cc..ac4de87 100644 --- a/README.md +++ b/README.md @@ -231,13 +231,13 @@ Contributions to SwiftNEW are welcome! MIT. Read the LICENSE file for details. - +Please feel free to open a pull request and add new language(s) or fix any typos/mistakes. ## Supported By diff --git a/README/README_hc.md b/README/README_hc.md new file mode 100644 index 0000000..83408b2 --- /dev/null +++ b/README/README_hc.md @@ -0,0 +1,244 @@ +# SwiftNEW + +![image](https://github.com/user-attachments/assets/0a5de416-f4cd-41b5-8060-f839f2e7286a) + +## 功能 +| 描述 | 版本 | +|---------------------------------------------------|-----------| +| 網格漸變同線性漸變背景 | 5.3.0 | +| Apple visionOS 同 Vision Pro 支援 | 4.1.0 | +| 版本/構建變更時自動觸發/彈出 .sheet | 4.0.0 | +| 版本號格式 x.y.z 同/或 x.y | 4.0.0 | +| 遠程下拉通知 | 3.5.0 | +| Firebase 實時數據庫 | 3.0.0 | +| 遠程 JSON 文件 | 3.0.0 | +| 版本控制 + 睇歷史 | 2.0.0 | +| 支持所有用例(包括商業/非營利) | - | +| 簡單模型,易於修改同重用 | - | +| 簡單綁定同數據傳遞 | - | +| 從本地存儲即時加載 | - | + +## 預覽 +![CleanShot 2022-06-11 at 22 54 15@2x](https://user-images.githubusercontent.com/54872601/173192927-ca2a8bef-2114-44f8-8d4d-47baadb8b4a8.png) + +## 展示 +![IMG_3472](https://user-images.githubusercontent.com/54872601/173187065-14d78119-47e7-4dcb-a3e6-c7fee4f0c67f.PNG) | ![IMG_3471](https://user-images.githubusercontent.com/54872601/173187067-fe3b5cac-54b5-4482-b73f-42e6c500546f.PNG) +------------- | ------------ +淺色主題 | 深色主題 + +![Simulator Screen Shot - iPhone 13 Pro Max](https://user-images.githubusercontent.com/54872601/178129999-ad63b0ce-d65e-4d86-9882-37a5090e92bc.png) | ![CleanShot 2022-12-11 at 12 46 30@2x](https://user-images.githubusercontent.com/54872601/206886933-bc4d0d33-e0fc-4013-9456-f19679b10f5b.png) ![CleanShot 2022-12-11 at 12 49 12@2x](https://user-images.githubusercontent.com/54872601/206887046-8ec82853-4e32-4a07-8b64-4cc984e7ec90.png) +------------- | ------------ +歷史視圖 (2.0.0) | 應用圖標 (3.9.6) [垂直 / 水平] + +![CleanShot 2023-06-22 at 14 24 07@2x](https://github.com/1998code/SwiftNEWKit/assets/54872601/12a8ab01-76e5-42a1-96b4-848ef5e5f36b) | Screenshot 2024-07-01 at 10 18 33 PM | +------------- | ------------ +支援 VisionOS (4.1.0 或更高版本) | 網格漸變背景 (5.3.0 或更高版本) + +## 示例 +路徑: `./Demo` (Xcode 項目) + +## 版本 +![GitHub release (latest by date)](https://img.shields.io/github/v/release/1998code/SwiftNEWKit?color=g&label=穩定版&style=for-the-badge) +![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/1998code/SwiftNEWKit?color=green&include_prereleases&label=測試版&style=for-the-badge) + +![swiftui-128x128_2x](https://user-images.githubusercontent.com/54872601/173193069-2eb486b0-1347-4448-ac2b-235b8f2f1bb0.png) + +## 測試平台同環境 +### 本地 +測試平台 | 最新版本 | 兼容版本 +-------- | ------ | ---------- +iOS | 18.4 | > 14 +iPadOS | 18.2 | > 14 +macOS | 15.2 | > 11 +visionOS | 2 | > 1 +### 雲端 +測試平台 | 兼容版本 +-------- | ---------- +Xcode | > 13.4 (13F17a) +macOS | > 12.3.1 (21E258) + +### 設置 +步驟 | 描述 | 截圖 +------| ----------- | ---------- +1 | 導航到根項目 | CleanShot 2022-06-11 at 17 39 39@2x +2 | 選擇項目 | CleanShot 2022-06-11 at 17 39 48@2x +3 | 選擇包依賴項 | CleanShot 2022-06-11 at 17 39 53@2x +4 | 點擊 + 同貼上 https://github.com/1998code/SwiftNEWKit 到搜索框 | CleanShot 2022-06-11 at 17 39 32@2x +5L | 創建一個名為 `data.json` 嘅新本地文件 | 你可以複製呢個 [JSON 示例](https://github.com/1998code/SwiftNEWKit#sample)。 +5R | 你都可以使用遠程 JSON / firebase 實時數據庫。 | 示例: https://testground-a937f-default-rtdb.firebaseio.com/0.json?print=pretty + +### 主要用法 +1. 導入包。 +```swift +import SwiftNEW +``` + +2. 喺 `body` 或任何 `some View` 之前添加狀態。 +### 狀態 +變量 | 建議值 | 選項 | 類型 +----------- | ------------------------------ | ----------------------------- | ---- +showNew * | false | false, true | Bool +align | .center | .leading, .center, .trailing | HorizontalAlignment +color | .accentColor | 支持所有顏色 | Color +size | "simple" | "invisible", "mini", "simple" | String +labelColor | UIColor.systemBackground 或 NSColor.windowBackgroundColor | 支持所有顏色 | Color +label | "顯示發布說明" | 所有字符串 | String +labelImage | "arrow.up.circle.fill" | 所有 SF 符號 | String +history | true | true, false | Bool +data | "data" 或 "https://.../{}.json"| "{本地JSON文件}" 或 遠程 | String +showDrop | false | false, true | Bool +mesh | true | false, true | Bool + +##### 示例: +```swift +// 必需 +@State var showNew: Bool = false + +// 可選 (5.2.0 或更高版本) +@State var align: HorizontalAlignment = .center +@State var color: Color = .accentColor +@State var size: String = "normal" +#if os(iOS) +@State var labelColor: Color = Color(UIColor.systemBackground) +#elseif os(macOS) +@State var labelColor: Color = Color(NSColor.windowBackgroundColor) +#endif +@State var label: String = "顯示發布說明" +@State var labelImage: String = "arrow.up.circle.fill" +@State var history: Bool = true +@State var data: String = "data" +@State var showDrop: Bool = false +@State var mesh: Bool = false +``` + +3. 然後,將此代碼粘貼到 `body` 或任何 `some View` 內部。 +```swift +// 5.2.0 或更高版本中使用默認選項嘅簡化版本 +SwiftNEW(show: $showNew) + +// 5.1.0 或更低版本 +SwiftNEW(show: $showNew, align: $align, color: $color, size: $size, labelColor: $labelColor, label: $label, labelImage: $labelImage, history: $history, data: $data, showDrop: $showDrop) +``` +除咗使用單獨嘅狀態外,內聯狀態都可以工作。(5.2.0 後唔再需要) + +*`Show Bool` 唔可以內聯。 +```swift +SwiftNEW(show: $showNew, align: .constant(.center), color: .constant(.accentColor), size: .constant("normal"), labelColor: .constant(Color(UIColor.systemBackground)), label: .constant("顯示發布說明"), labelImage: .constant("arrow.up.circle.fill"), history: .constant(true), data: .constant("data"), showDrop: .constant(false)) +``` + +4. 你嘅代碼應該類似於以下內容,包含最小功能同默認樣式。 +```swift +struct ContentView: View { + @State var showNew: Bool = false + var body: some View { + SwiftNEW(show: $showNew) + } +} +``` + +### JSON +#### 結構 / 模型 (參考) +* 以下代碼僅供參考。你唔需要複製結構或模型。 +```swift +public struct Vmodel: Codable, Hashable { + var version: String + var new: [Model] +} +public struct Model: Codable, Hashable { + var icon: String + var title: String + var subtitle: String + var body: String +} +``` + +#### 示例 +將 JSON 示例複製到 `data.json` 文件中(如果你冇該文件,請創建一個新文件。) + +![68747470733a2f2f76616c696461746f722e737761676765722e696f2f76616c696461746f723f75726c3d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f4f41492f4f70656e4150492d53706563696669636174696f6e2f6d61737465722f6578616d706c65732f76](https://user-images.githubusercontent.com/54872601/173190828-8ee763b9-4e33-4231-92ac-eb81b556c462.png) +```json +[ + { + "version": "1.2", + "new": [ + { + "body": "適用於 iOS 16, iPadOS 16, macOS 13", + "icon": "hammer.fill", + "subtitle": "修復UI問題", + "title": "錯誤修復" + }, + { + "body": "通過遠程存儲直接加載。好簡單!", + "icon": "square.and.arrow.down.fill", + "subtitle": "已支持", + "title": "Firebase 遠程" + }, + { + "body": "免費開源!由 Ming 用 ❤️‍🔥 創建", + "icon": "macpro.gen3.server", + "subtitle": "設計", + "title": "無服務器" + }, + { + "body": "提交拉取請求,令佢對每個人都更好!", + "icon": "arrow.triangle.pull", + "subtitle": "一齊", + "title": "貢獻" + } + ] + }, + { + "version": "1.1", + "new": [ + { + "body": "適用於 iOS 16, iPadOS 16, macOS 13", + "icon": "hammer.fill", + "subtitle": "修復UI問題", + "title": "錯誤修復" + }, + { + "body": "通過本地存儲直接加載。超快速!", + "icon": "square.and.arrow.down.fill", + "subtitle": "已支持", + "title": "本地文件" + }, + { + "body": "免費開源!由 Ming 用 ❤️‍🔥 創建", + "icon": "macpro.gen3.server", + "subtitle": "設計", + "title": "無服務器" + }, + { + "body": "提交拉取請求,令佢對每個人都更好!", + "icon": "arrow.triangle.pull", + "subtitle": "一齊", + "title": "貢獻" + } + ] + } +] +``` + +## 貢獻 + +歡迎對 SwiftNEW 做出貢獻! + +- 要報告錯誤或請求功能,請喺 GitHub 上提出問題 +- 提交拉取請求時,請遵循項目嘅編碼風格 + +## 許可證 + +MIT。 詳情請閱讀 LICENSE 文件。 + +## 翻譯 + +呢個文檔仲有其他語言版本: + +[English](../README.md) | [简中](README_zh.md) / [繁中](README_tc.md) / 粵語 | [日本語](README_ja.md) | [한국어](README_ko.md) + +請隨時提交拉取請求,添加新語言或修復任何錯別字/錯誤。 + +## 支持 + + + \ No newline at end of file diff --git a/README/README_ja.md b/README/README_ja.md new file mode 100644 index 0000000..4e2fb48 --- /dev/null +++ b/README/README_ja.md @@ -0,0 +1,244 @@ +# SwiftNEW + +![image](https://github.com/user-attachments/assets/0a5de416-f4cd-41b5-8060-f839f2e7286a) + +## 機能 +| 説明 | バージョン | +|---------------------------------------------------|-----------| +| メッシュグラデーションと線形グラデーションの背景 | 5.3.0 | +| Apple visionOS と Vision Pro サポート | 4.1.0 | +| バージョン/ビルド変更時に自動的にトリガー/ポップアップする .sheet | 4.0.0 | +| バージョン番号形式 x.y.z および/または x.y | 4.0.0 | +| リモートドロップ通知 | 3.5.0 | +| Firebase リアルタイムデータベース | 3.0.0 | +| リモート JSON ファイル | 3.0.0 | +| バージョン管理 + 履歴表示 | 2.0.0 | +| 商業/非営利を含むすべてのユースケースをサポート | - | +| シンプルなモデル、簡単に変更や再利用が可能 | - | +| シンプルなバインディングとデータの受け渡し | - | +| ローカルストレージからの即時読み込み | - | + +## プレビュー +![CleanShot 2022-06-11 at 22 54 15@2x](https://user-images.githubusercontent.com/54872601/173192927-ca2a8bef-2114-44f8-8d4d-47baadb8b4a8.png) + +## ギャラリー +![IMG_3472](https://user-images.githubusercontent.com/54872601/173187065-14d78119-47e7-4dcb-a3e6-c7fee4f0c67f.PNG) | ![IMG_3471](https://user-images.githubusercontent.com/54872601/173187067-fe3b5cac-54b5-4482-b73f-42e6c500546f.PNG) +------------- | ------------ +ライトモード | ダークモード + +![Simulator Screen Shot - iPhone 13 Pro Max](https://user-images.githubusercontent.com/54872601/178129999-ad63b0ce-d65e-4d86-9882-37a5090e92bc.png) | ![CleanShot 2022-12-11 at 12 46 30@2x](https://user-images.githubusercontent.com/54872601/206886933-bc4d0d33-e0fc-4013-9456-f19679b10f5b.png) ![CleanShot 2022-12-11 at 12 49 12@2x](https://user-images.githubusercontent.com/54872601/206887046-8ec82853-4e32-4a07-8b64-4cc984e7ec90.png) +------------- | ------------ +履歴ビュー (2.0.0) | アプリアイコン (3.9.6) [垂直 / 水平] + +![CleanShot 2023-06-22 at 14 24 07@2x](https://github.com/1998code/SwiftNEWKit/assets/54872601/12a8ab01-76e5-42a1-96b4-848ef5e5f36b) | Screenshot 2024-07-01 at 10 18 33 PM | +------------- | ------------ +VisionOS サポート (4.1.0 以上) | メッシュグラデーション背景 (5.3.0 以上) + +## サンプル +パス: `./Demo` (Xcode プロジェクト) + +## バージョン +![GitHub release (latest by date)](https://img.shields.io/github/v/release/1998code/SwiftNEWKit?color=g&label=安定版&style=for-the-badge) +![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/1998code/SwiftNEWKit?color=green&include_prereleases&label=ベータ版&style=for-the-badge) + +![swiftui-128x128_2x](https://user-images.githubusercontent.com/54872601/173193069-2eb486b0-1347-4448-ac2b-235b8f2f1bb0.png) + +## テスト済みプラットフォームと環境 +### ローカル +テスト済み | 最新バージョン | 互換性あり +--------- | ------------ | ---------- +iOS | 18.4 | > 14 +iPadOS | 18.2 | > 14 +macOS | 15.2 | > 11 +visionOS | 2 | > 1 +### クラウド +テスト済み | 互換性あり +--------- | ---------- +Xcode | > 13.4 (13F17a) +macOS | > 12.3.1 (21E258) + +### セットアップ +ステップ | 説明 | スクリーンショット +------| ----------- | ---------- +1 | ルートプロジェクトに移動 | CleanShot 2022-06-11 at 17 39 39@2x +2 | プロジェクトを選択 | CleanShot 2022-06-11 at 17 39 48@2x +3 | パッケージ依存関係を選択 | CleanShot 2022-06-11 at 17 39 53@2x +4 | + をクリックし、検索ボックスに https://github.com/1998code/SwiftNEWKit を貼り付け | CleanShot 2022-06-11 at 17 39 32@2x +5L | `data.json` という名前の新しいローカルファイルを作成 | この [JSON サンプル](https://github.com/1998code/SwiftNEWKit#sample) をコピーできます。 +5R | リモート JSON / Firebase リアルタイムデータベースも使用できます。 | サンプル: https://testground-a937f-default-rtdb.firebaseio.com/0.json?print=pretty + +### 主な使用方法 +1. パッケージをインポートします。 +```swift +import SwiftNEW +``` + +2. `body` または任意の `some View` の前に状態を追加します。 +### 状態 +変数 | 推奨値 | オプション | 型 +----------- | ------------------------------ | ----------------------------- | ---- +showNew * | false | false, true | Bool +align | .center | .leading, .center, .trailing | HorizontalAlignment +color | .accentColor | すべての色をサポート | Color +size | "simple" | "invisible", "mini", "simple" | String +labelColor | UIColor.systemBackground または NSColor.windowBackgroundColor | すべての色をサポート | Color +label | "リリースノートを表示" | すべての文字列 | String +labelImage | "arrow.up.circle.fill" | すべての SF シンボル | String +history | true | true, false | Bool +data | "data" または "https://.../{}.json"| "{ローカルJSONファイル}" または リモート | String +showDrop | false | false, true | Bool +mesh | true | false, true | Bool + +##### サンプル: +```swift +// 必須 +@State var showNew: Bool = false + +// オプション (5.2.0 以上) +@State var align: HorizontalAlignment = .center +@State var color: Color = .accentColor +@State var size: String = "normal" +#if os(iOS) +@State var labelColor: Color = Color(UIColor.systemBackground) +#elseif os(macOS) +@State var labelColor: Color = Color(NSColor.windowBackgroundColor) +#endif +@State var label: String = "リリースノートを表示" +@State var labelImage: String = "arrow.up.circle.fill" +@State var history: Bool = true +@State var data: String = "data" +@State var showDrop: Bool = false +@State var mesh: Bool = false +``` + +3. 次に、このコードを `body` または任意の `some View` 内に貼り付けます。 +```swift +// 5.2.0 以上でデフォルトオプションを使用した簡略版 +SwiftNEW(show: $showNew) + +// 5.1.0 以下 +SwiftNEW(show: $showNew, align: $align, color: $color, size: $size, labelColor: $labelColor, label: $label, labelImage: $labelImage, history: $history, data: $data, showDrop: $showDrop) +``` +個別の状態を使用する代わりに、インライン状態も機能します。(5.2.0 以降は不要) + +*`Show Bool` はインラインにできません。 +```swift +SwiftNEW(show: $showNew, align: .constant(.center), color: .constant(.accentColor), size: .constant("normal"), labelColor: .constant(Color(UIColor.systemBackground)), label: .constant("リリースノートを表示"), labelImage: .constant("arrow.up.circle.fill"), history: .constant(true), data: .constant("data"), showDrop: .constant(false)) +``` + +4. コードは以下のようになり、最小限の機能とデフォルトスタイルが含まれています。 +```swift +struct ContentView: View { + @State var showNew: Bool = false + var body: some View { + SwiftNEW(show: $showNew) + } +} +``` + +### JSON +#### 構造 / モデル (参照) +* 以下のコードは参考用です。構造体やモデルをコピーする必要はありません。 +```swift +public struct Vmodel: Codable, Hashable { + var version: String + var new: [Model] +} +public struct Model: Codable, Hashable { + var icon: String + var title: String + var subtitle: String + var body: String +} +``` + +#### サンプル +JSON サンプルを `data.json` ファイルにコピーします(ファイルがない場合は、新しいファイルを作成してください)。 + +![68747470733a2f2f76616c696461746f722e737761676765722e696f2f76616c696461746f723f75726c3d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f4f41492f4f70656e4150492d53706563696669636174696f6e2f6d61737465722f6578616d706c65732f76](https://user-images.githubusercontent.com/54872601/173190828-8ee763b9-4e33-4231-92ac-eb81b556c462.png) +```json +[ + { + "version": "1.2", + "new": [ + { + "body": "iOS 16、iPadOS 16、macOS 13 に対応", + "icon": "hammer.fill", + "subtitle": "UI の問題を修正", + "title": "バグ修正" + }, + { + "body": "リモートストレージから直接読み込み。簡単です!", + "icon": "square.and.arrow.down.fill", + "subtitle": "サポート済み", + "title": "Firebase リモート" + }, + { + "body": "無料でオープンソース!Ming が ❤️‍🔥 で作成", + "icon": "macpro.gen3.server", + "subtitle": "デザイン", + "title": "サーバーレス" + }, + { + "body": "プルリクエストを送信して、みんなのためにもっと良くしよう!", + "icon": "arrow.triangle.pull", + "subtitle": "一緒に", + "title": "貢献" + } + ] + }, + { + "version": "1.1", + "new": [ + { + "body": "iOS 16、iPadOS 16、macOS 13 に対応", + "icon": "hammer.fill", + "subtitle": "UI の問題を修正", + "title": "バグ修正" + }, + { + "body": "ローカルストレージから直接読み込み。超高速!", + "icon": "square.and.arrow.down.fill", + "subtitle": "サポート済み", + "title": "ローカルファイル" + }, + { + "body": "無料でオープンソース!Ming が ❤️‍🔥 で作成", + "icon": "macpro.gen3.server", + "subtitle": "デザイン", + "title": "サーバーレス" + }, + { + "body": "プルリクエストを送信して、みんなのためにもっと良くしよう!", + "icon": "arrow.triangle.pull", + "subtitle": "一緒に", + "title": "貢献" + } + ] + } +] +``` + +## 貢献 + +SwiftNEW への貢献を歓迎します! + +- バグの報告や機能のリクエストは、GitHub で Issue を作成してください +- プルリクエストを提出する際は、プロジェクトのコーディングスタイルに従ってください + +## ライセンス + +MIT。詳細については LICENSE ファイルをお読みください。 + +## 翻訳 + +このドキュメントは他の言語でもご利用いただけます: + +[English](../README.md) | [简中](README_zh.md) / [繁中](README_tc.md) / [粵語](README_hc.md) | 日本語 | [한국어](README_ko.md) + +新しい言語の追加や誤字・間違いの修正など、プルリクエストをお気軽にお送りください。 + +## サポート + + + \ No newline at end of file diff --git a/README/README_ko.md b/README/README_ko.md new file mode 100644 index 0000000..57eb7a7 --- /dev/null +++ b/README/README_ko.md @@ -0,0 +1,244 @@ +# SwiftNEW + +![image](https://github.com/user-attachments/assets/0a5de416-f4cd-41b5-8060-f839f2e7286a) + +## 기능 +| 설명 | 버전 | +|---------------------------------------------------|-----------| +| 메쉬 그라데이션 및 선형 그라데이션 배경 | 5.3.0 | +| Apple visionOS 및 Vision Pro 지원 | 4.1.0 | +| 버전/빌드 변경 시 자동으로 트리거/팝업 되는 .sheet | 4.0.0 | +| 버전 번호 형식 x.y.z 및/또는 x.y | 4.0.0 | +| 원격 드롭 알림 | 3.5.0 | +| Firebase 실시간 데이터베이스 | 3.0.0 | +| 원격 JSON 파일 | 3.0.0 | +| 버전 관리 + 기록 보기 | 2.0.0 | +| 상업적/비영리적 포함 모든 사용 사례 지원 | - | +| 간단한 모델, 쉬운 수정 및 재사용 | - | +| 간단한 바인딩 및 데이터 전달 | - | +| 로컬 스토리지에서 즉시 로드 | - | + +## 미리보기 +![CleanShot 2022-06-11 at 22 54 15@2x](https://user-images.githubusercontent.com/54872601/173192927-ca2a8bef-2114-44f8-8d4d-47baadb8b4a8.png) + +## 갤러리 +![IMG_3472](https://user-images.githubusercontent.com/54872601/173187065-14d78119-47e7-4dcb-a3e6-c7fee4f0c67f.PNG) | ![IMG_3471](https://user-images.githubusercontent.com/54872601/173187067-fe3b5cac-54b5-4482-b73f-42e6c500546f.PNG) +------------- | ------------ +라이트 모드 | 다크 모드 + +![Simulator Screen Shot - iPhone 13 Pro Max](https://user-images.githubusercontent.com/54872601/178129999-ad63b0ce-d65e-4d86-9882-37a5090e92bc.png) | ![CleanShot 2022-12-11 at 12 46 30@2x](https://user-images.githubusercontent.com/54872601/206886933-bc4d0d33-e0fc-4013-9456-f19679b10f5b.png) ![CleanShot 2022-12-11 at 12 49 12@2x](https://user-images.githubusercontent.com/54872601/206887046-8ec82853-4e32-4a07-8b64-4cc984e7ec90.png) +------------- | ------------ +기록 보기 (2.0.0) | 앱 아이콘 (3.9.6) [세로 / 가로] + +![CleanShot 2023-06-22 at 14 24 07@2x](https://github.com/1998code/SwiftNEWKit/assets/54872601/12a8ab01-76e5-42a1-96b4-848ef5e5f36b) | Screenshot 2024-07-01 at 10 18 33 PM | +------------- | ------------ +VisionOS 지원 (4.1.0 이상) | 메쉬 그라데이션 배경 (5.3.0 이상) + +## 예제 +경로: `./Demo` (Xcode 프로젝트) + +## 버전 +![GitHub release (latest by date)](https://img.shields.io/github/v/release/1998code/SwiftNEWKit?color=g&label=안정&style=for-the-badge) +![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/1998code/SwiftNEWKit?color=green&include_prereleases&label=베타&style=for-the-badge) + +![swiftui-128x128_2x](https://user-images.githubusercontent.com/54872601/173193069-2eb486b0-1347-4448-ac2b-235b8f2f1bb0.png) + +## 테스트된 플랫폼 및 환경 +### 로컬 +테스트됨 | 최신 버전 | 호환 가능 +--------- | ------ | ---------- +iOS | 18.4 | > 14 +iPadOS | 18.2 | > 14 +macOS | 15.2 | > 11 +visionOS | 2 | > 1 +### 클라우드 +테스트됨 | 호환 가능 +--------- | ---------- +Xcode | > 13.4 (13F17a) +macOS | > 12.3.1 (21E258) + +### 설정 +단계 | 설명 | 스크린샷 +------| ----------- | ---------- +1 | 루트 프로젝트로 이동 | CleanShot 2022-06-11 at 17 39 39@2x +2 | 프로젝트 선택 | CleanShot 2022-06-11 at 17 39 48@2x +3 | 패키지 종속성 선택 | CleanShot 2022-06-11 at 17 39 53@2x +4 | + 클릭 후 검색 상자에 https://github.com/1998code/SwiftNEWKit 붙여넣기 | CleanShot 2022-06-11 at 17 39 32@2x +5L | `data.json`이라는 새 로컬 파일 생성 | 이 [JSON 샘플](https://github.com/1998code/SwiftNEWKit#sample)을 복사할 수 있습니다. +5R | 원격 JSON / Firebase 실시간 데이터베이스도 사용 가능합니다. | 샘플: https://testground-a937f-default-rtdb.firebaseio.com/0.json?print=pretty + +### 주요 사용법 +1. 패키지를 가져옵니다. +```swift +import SwiftNEW +``` + +2. `body` 또는 `some View` 앞에 상태를 추가합니다. +### 상태 +변수 | 권장값 | 옵션 | 타입 +----------- | ------------------------------ | ----------------------------- | ---- +showNew * | false | false, true | Bool +align | .center | .leading, .center, .trailing | HorizontalAlignment +color | .accentColor | 모든 색상 지원 | Color +size | "simple" | "invisible", "mini", "simple" | String +labelColor | UIColor.systemBackground 또는 NSColor.windowBackgroundColor | 모든 색상 지원 | Color +label | "릴리스 노트 보기" | 모든 문자열 | String +labelImage | "arrow.up.circle.fill" | 모든 SF 심볼 | String +history | true | true, false | Bool +data | "data" 또는 "https://.../{}.json"| "{로컬_JSON_파일}" 또는 원격 | String +showDrop | false | false, true | Bool +mesh | true | false, true | Bool + +##### 예제: +```swift +// 필수 +@State var showNew: Bool = false + +// 선택 사항 (5.2.0 이상) +@State var align: HorizontalAlignment = .center +@State var color: Color = .accentColor +@State var size: String = "normal" +#if os(iOS) +@State var labelColor: Color = Color(UIColor.systemBackground) +#elseif os(macOS) +@State var labelColor: Color = Color(NSColor.windowBackgroundColor) +#endif +@State var label: String = "릴리스 노트 보기" +@State var labelImage: String = "arrow.up.circle.fill" +@State var history: Bool = true +@State var data: String = "data" +@State var showDrop: Bool = false +@State var mesh: Bool = false +``` + +3. 그런 다음, 이 코드를 `body` 또는 `some View` 안에 붙여넣습니다. +```swift +// 5.2.0 이상에서 기본 옵션으로 간소화된 버전 +SwiftNEW(show: $showNew) + +// 5.1.0 이하 +SwiftNEW(show: $showNew, align: $align, color: $color, size: $size, labelColor: $labelColor, label: $label, labelImage: $labelImage, history: $history, data: $data, showDrop: $showDrop) +``` +개별 상태를 사용하는 대신 인라인 상태도 작동합니다. (5.2.0 이후로는 더 이상 필요하지 않음) + +*`Show Bool`은 인라인으로 사용할 수 없습니다. +```swift +SwiftNEW(show: $showNew, align: .constant(.center), color: .constant(.accentColor), size: .constant("normal"), labelColor: .constant(Color(UIColor.systemBackground)), label: .constant("릴리스 노트 보기"), labelImage: .constant("arrow.up.circle.fill"), history: .constant(true), data: .constant("data"), showDrop: .constant(false)) +``` + +4. 코드는 최소 기능과 기본 스타일을 포함하여 다음과 유사하게 보일 것입니다. +```swift +struct ContentView: View { + @State var showNew: Bool = false + var body: some View { + SwiftNEW(show: $showNew) + } +} +``` + +### JSON +#### 구조 / 모델 (참조) +* 아래 코드는 참조용입니다. 구조체나 모델을 복사할 필요는 없습니다. +```swift +public struct Vmodel: Codable, Hashable { + var version: String + var new: [Model] +} +public struct Model: Codable, Hashable { + var icon: String + var title: String + var subtitle: String + var body: String +} +``` + +#### 샘플 +JSON 샘플을 `data.json` 파일에 복사합니다(파일이 없는 경우 새 파일을 만드세요). + +![68747470733a2f2f76616c696461746f722e737761676765722e696f2f76616c696461746f723f75726c3d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f4f41492f4f70656e4150492d53706563696669636174696f6e2f6d61737465722f6578616d706c65732f76](https://user-images.githubusercontent.com/54872601/173190828-8ee763b9-4e33-4231-92ac-eb81b556c462.png) +```json +[ + { + "version": "1.2", + "new": [ + { + "body": "iOS 16, iPadOS 16, macOS 13에서 사용 가능", + "icon": "hammer.fill", + "subtitle": "UI 문제 수정", + "title": "버그 수정" + }, + { + "body": "원격 스토리지를 통한 직접 로드. 간단합니다!", + "icon": "square.and.arrow.down.fill", + "subtitle": "지원됨", + "title": "Firebase 원격" + }, + { + "body": "무료 오픈 소스! Ming이 ❤️‍🔥로 만듦", + "icon": "macpro.gen3.server", + "subtitle": "디자인", + "title": "서버리스" + }, + { + "body": "풀 리퀘스트를 보내서 모두에게 더 좋게 만들어보세요!", + "icon": "arrow.triangle.pull", + "subtitle": "함께", + "title": "기여하기" + } + ] + }, + { + "version": "1.1", + "new": [ + { + "body": "iOS 16, iPadOS 16, macOS 13에서 사용 가능", + "icon": "hammer.fill", + "subtitle": "UI 문제 수정", + "title": "버그 수정" + }, + { + "body": "로컬 스토리지를 통한 직접 로드. 초고속!", + "icon": "square.and.arrow.down.fill", + "subtitle": "지원됨", + "title": "로컬 파일" + }, + { + "body": "무료 오픈 소스! Ming이 ❤️‍🔥로 만듦", + "icon": "macpro.gen3.server", + "subtitle": "디자인", + "title": "서버리스" + }, + { + "body": "풀 리퀘스트를 보내서 모두에게 더 좋게 만들어보세요!", + "icon": "arrow.triangle.pull", + "subtitle": "함께", + "title": "기여하기" + } + ] + } +] +``` + +## 기여하기 + +SwiftNEW에 기여해 주세요! + +- 버그를 보고하거나 기능을 요청하려면 GitHub에서 이슈를 열어주세요 +- 풀 리퀘스트를 제출할 때는 프로젝트의 코딩 스타일을 따라주세요 + +## 라이선스 + +MIT. 자세한 내용은 LICENSE 파일을 참조하세요. + +## 번역 + +이 문서는 다른 언어로도 제공됩니다: + +[English](../README.md) | [简中](README_zh.md) / [繁中](README_tc.md) / [粵語](README_hc.md) | [日本語](README_ja.md) | 한국어 + +새로운 언어를 추가하거나 오타/실수를 수정하기 위한 풀 리퀘스트를 자유롭게 열어주세요. + +## 지원 + + + \ No newline at end of file diff --git a/README/README_tc.md b/README/README_tc.md new file mode 100644 index 0000000..fbb8fe3 --- /dev/null +++ b/README/README_tc.md @@ -0,0 +1,244 @@ +# SwiftNEW + +![image](https://github.com/user-attachments/assets/0a5de416-f4cd-41b5-8060-f839f2e7286a) + +## 功能 +| 描述 | 版本 | +|---------------------------------------------------|-----------| +| 網格漸變和線性漸變背景 | 5.3.0 | +| Apple visionOS 與 Vision Pro 支援 | 4.1.0 | +| 版本/構建變更時自動觸發/彈出 .sheet | 4.0.0 | +| 版本號格式 x.y.z 和/或 x.y | 4.0.0 | +| 遠程下拉通知 | 3.5.0 | +| Firebase 實時數據庫 | 3.0.0 | +| 遠程 JSON 文件 | 3.0.0 | +| 版本控制 + 查看歷史 | 2.0.0 | +| 支持所有用例(包括商業/非營利) | - | +| 簡單模型,易於修改和重用 | - | +| 簡單綁定和數據傳遞 | - | +| 從本地存儲即時加載 | - | + +## 預覽 +![CleanShot 2022-06-11 at 22 54 15@2x](https://user-images.githubusercontent.com/54872601/173192927-ca2a8bef-2114-44f8-8d4d-47baadb8b4a8.png) + +## 展示 +![IMG_3472](https://user-images.githubusercontent.com/54872601/173187065-14d78119-47e7-4dcb-a3e6-c7fee4f0c67f.PNG) | ![IMG_3471](https://user-images.githubusercontent.com/54872601/173187067-fe3b5cac-54b5-4482-b73f-42e6c500546f.PNG) +------------- | ------------ +淺色主題 | 深色主題 + +![Simulator Screen Shot - iPhone 13 Pro Max](https://user-images.githubusercontent.com/54872601/178129999-ad63b0ce-d65e-4d86-9882-37a5090e92bc.png) | ![CleanShot 2022-12-11 at 12 46 30@2x](https://user-images.githubusercontent.com/54872601/206886933-bc4d0d33-e0fc-4013-9456-f19679b10f5b.png) ![CleanShot 2022-12-11 at 12 49 12@2x](https://user-images.githubusercontent.com/54872601/206887046-8ec82853-4e32-4a07-8b64-4cc984e7ec90.png) +------------- | ------------ +歷史視圖 (2.0.0) | 應用圖標 (3.9.6) [垂直 / 水平] + +![CleanShot 2023-06-22 at 14 24 07@2x](https://github.com/1998code/SwiftNEWKit/assets/54872601/12a8ab01-76e5-42a1-96b4-848ef5e5f36b) | Screenshot 2024-07-01 at 10 18 33 PM | +------------- | ------------ +支援 VisionOS (4.1.0 或更高版本) | 網格漸變背景 (5.3.0 或更高版本) + +## 示例 +路徑: `./Demo` (Xcode 項目) + +## 版本 +![GitHub release (latest by date)](https://img.shields.io/github/v/release/1998code/SwiftNEWKit?color=g&label=穩定版&style=for-the-badge) +![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/1998code/SwiftNEWKit?color=green&include_prereleases&label=測試版&style=for-the-badge) + +![swiftui-128x128_2x](https://user-images.githubusercontent.com/54872601/173193069-2eb486b0-1347-4448-ac2b-235b8f2f1bb0.png) + +## 測試平台和環境 +### 本地 +測試平台 | 最新版本 | 兼容版本 +-------- | ------ | ---------- +iOS | 18.4 | > 14 +iPadOS | 18.2 | > 14 +macOS | 15.2 | > 11 +visionOS | 2 | > 1 +### 雲端 +測試平台 | 兼容版本 +-------- | ---------- +Xcode | > 13.4 (13F17a) +macOS | > 12.3.1 (21E258) + +### 設置 +步驟 | 描述 | 截圖 +------| ----------- | ---------- +1 | 導航到根項目 | CleanShot 2022-06-11 at 17 39 39@2x +2 | 選擇項目 | CleanShot 2022-06-11 at 17 39 48@2x +3 | 選擇包依賴項 | CleanShot 2022-06-11 at 17 39 53@2x +4 | 點擊 + 並貼上 https://github.com/1998code/SwiftNEWKit 到搜索框 | CleanShot 2022-06-11 at 17 39 32@2x +5L | 創建一個名為 `data.json` 的新本地文件 | 您可以複製這個 [JSON 示例](https://github.com/1998code/SwiftNEWKit#sample)。 +5R | 您也可以使用遠程 JSON / firebase 實時數據庫。 | 示例: https://testground-a937f-default-rtdb.firebaseio.com/0.json?print=pretty + +### 主要用法 +1. 導入包。 +```swift +import SwiftNEW +``` + +2. 在 `body` 或任何 `some View` 之前添加狀態。 +### 狀態 +變量 | 建議值 | 選項 | 類型 +----------- | ------------------------------ | ----------------------------- | ---- +showNew * | false | false, true | Bool +align | .center | .leading, .center, .trailing | HorizontalAlignment +color | .accentColor | 支持所有顏色 | Color +size | "simple" | "invisible", "mini", "simple" | String +labelColor | UIColor.systemBackground 或 NSColor.windowBackgroundColor | 支持所有顏色 | Color +label | "顯示發布說明" | 所有字符串 | String +labelImage | "arrow.up.circle.fill" | 所有 SF 符號 | String +history | true | true, false | Bool +data | "data" 或 "https://.../{}.json"| "{本地JSON文件}" 或 遠程 | String +showDrop | false | false, true | Bool +mesh | true | false, true | Bool + +##### 示例: +```swift +// 必需 +@State var showNew: Bool = false + +// 可選 (5.2.0 或更高版本) +@State var align: HorizontalAlignment = .center +@State var color: Color = .accentColor +@State var size: String = "normal" +#if os(iOS) +@State var labelColor: Color = Color(UIColor.systemBackground) +#elseif os(macOS) +@State var labelColor: Color = Color(NSColor.windowBackgroundColor) +#endif +@State var label: String = "顯示發布說明" +@State var labelImage: String = "arrow.up.circle.fill" +@State var history: Bool = true +@State var data: String = "data" +@State var showDrop: Bool = false +@State var mesh: Bool = false +``` + +3. 然後,將此代碼粘貼到 `body` 或任何 `some View` 內部。 +```swift +// 5.2.0 或更高版本中使用默認選項的簡化版本 +SwiftNEW(show: $showNew) + +// 5.1.0 或更低版本 +SwiftNEW(show: $showNew, align: $align, color: $color, size: $size, labelColor: $labelColor, label: $label, labelImage: $labelImage, history: $history, data: $data, showDrop: $showDrop) +``` +除了使用單獨的狀態外,內聯狀態也可以工作。(5.2.0 後不再需要) + +*`Show Bool` 不能內聯。 +```swift +SwiftNEW(show: $showNew, align: .constant(.center), color: .constant(.accentColor), size: .constant("normal"), labelColor: .constant(Color(UIColor.systemBackground)), label: .constant("顯示發布說明"), labelImage: .constant("arrow.up.circle.fill"), history: .constant(true), data: .constant("data"), showDrop: .constant(false)) +``` + +4. 您的代碼應類似於以下內容,包含最小功能和默認樣式。 +```swift +struct ContentView: View { + @State var showNew: Bool = false + var body: some View { + SwiftNEW(show: $showNew) + } +} +``` + +### JSON +#### 結構 / 模型 (參考) +* 以下代碼僅供參考。您不需要複製結構或模型。 +```swift +public struct Vmodel: Codable, Hashable { + var version: String + var new: [Model] +} +public struct Model: Codable, Hashable { + var icon: String + var title: String + var subtitle: String + var body: String +} +``` + +#### 示例 +將 JSON 示例複製到 `data.json` 文件中(如果您沒有該文件,請創建一個新文件。) + +![68747470733a2f2f76616c696461746f722e737761676765722e696f2f76616c696461746f723f75726c3d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f4f41492f4f70656e4150492d53706563696669636174696f6e2f6d61737465722f6578616d706c65732f76](https://user-images.githubusercontent.com/54872601/173190828-8ee763b9-4e33-4231-92ac-eb81b556c462.png) +```json +[ + { + "version": "1.2", + "new": [ + { + "body": "適用於 iOS 16, iPadOS 16, macOS 13", + "icon": "hammer.fill", + "subtitle": "修復UI問題", + "title": "錯誤修復" + }, + { + "body": "通過遠程存儲直接加載。很簡單!", + "icon": "square.and.arrow.down.fill", + "subtitle": "已支持", + "title": "Firebase 遠程" + }, + { + "body": "免費開源!由 Ming 用 ❤️‍🔥 創建", + "icon": "macpro.gen3.server", + "subtitle": "設計", + "title": "無服務器" + }, + { + "body": "提交拉取請求,讓它對每個人都更好!", + "icon": "arrow.triangle.pull", + "subtitle": "一起", + "title": "貢獻" + } + ] + }, + { + "version": "1.1", + "new": [ + { + "body": "適用於 iOS 16, iPadOS 16, macOS 13", + "icon": "hammer.fill", + "subtitle": "修復UI問題", + "title": "錯誤修復" + }, + { + "body": "通過本地存儲直接加載。超快速!", + "icon": "square.and.arrow.down.fill", + "subtitle": "已支持", + "title": "本地文件" + }, + { + "body": "免費開源!由 Ming 用 ❤️‍🔥 創建", + "icon": "macpro.gen3.server", + "subtitle": "設計", + "title": "無服務器" + }, + { + "body": "提交拉取請求,讓它對每個人都更好!", + "icon": "arrow.triangle.pull", + "subtitle": "一起", + "title": "貢獻" + } + ] + } +] +``` + +## 貢獻 + +歡迎對 SwiftNEW 做出貢獻! + +- 要報告錯誤或請求功能,請在 GitHub 上提出問題 +- 提交拉取請求時,請遵循項目的編碼風格 + +## 許可證 + +MIT。 詳情請閱讀 LICENSE 文件。 + +## 翻譯 + +本文檔還有其他語言版本: + +[English](../README.md) | [简中](README_zh.md) / 繁中 / [粵語](README_hc.md) | [日本語](README_ja.md) | [한국어](README_ko.md) + +請隨時提交拉取請求,添加新語言或修復任何錯別字/錯誤。 + +## 支持 + + + \ No newline at end of file diff --git a/README/README_zh.md b/README/README_zh.md new file mode 100644 index 0000000..ee06a69 --- /dev/null +++ b/README/README_zh.md @@ -0,0 +1,244 @@ +# SwiftNEW + +![image](https://github.com/user-attachments/assets/0a5de416-f4cd-41b5-8060-f839f2e7286a) + +## 功能 +| 描述 | 版本 | +|---------------------------------------------------|-----------| +| 网格渐变和线性渐变背景 | 5.3.0 | +| Apple visionOS 与 Vision Pro 支持 | 4.1.0 | +| 版本/构建变更时自动触发/弹出 .sheet | 4.0.0 | +| 版本号格式 x.y.z 和/或 x.y | 4.0.0 | +| 远程下拉通知 | 3.5.0 | +| Firebase 实时数据库 | 3.0.0 | +| 远程 JSON 文件 | 3.0.0 | +| 版本控制 + 查看历史 | 2.0.0 | +| 支持所有用例(包括商业/非营利) | - | +| 简单模型,易于修改和重用 | - | +| 简单绑定和数据传递 | - | +| 从本地存储即时加载 | - | + +## 预览 +![CleanShot 2022-06-11 at 22 54 15@2x](https://user-images.githubusercontent.com/54872601/173192927-ca2a8bef-2114-44f8-8d4d-47baadb8b4a8.png) + +## 展示 +![IMG_3472](https://user-images.githubusercontent.com/54872601/173187065-14d78119-47e7-4dcb-a3e6-c7fee4f0c67f.PNG) | ![IMG_3471](https://user-images.githubusercontent.com/54872601/173187067-fe3b5cac-54b5-4482-b73f-42e6c500546f.PNG) +------------- | ------------ +浅色主题 | 深色主题 + +![Simulator Screen Shot - iPhone 13 Pro Max](https://user-images.githubusercontent.com/54872601/178129999-ad63b0ce-d65e-4d86-9882-37a5090e92bc.png) | ![CleanShot 2022-12-11 at 12 46 30@2x](https://user-images.githubusercontent.com/54872601/206886933-bc4d0d33-e0fc-4013-9456-f19679b10f5b.png) ![CleanShot 2022-12-11 at 12 49 12@2x](https://user-images.githubusercontent.com/54872601/206887046-8ec82853-4e32-4a07-8b64-4cc984e7ec90.png) +------------- | ------------ +历史视图 (2.0.0) | 应用图标 (3.9.6) [垂直 / 水平] + +![CleanShot 2023-06-22 at 14 24 07@2x](https://github.com/1998code/SwiftNEWKit/assets/54872601/12a8ab01-76e5-42a1-96b4-848ef5e5f36b) | Screenshot 2024-07-01 at 10 18 33 PM | +------------- | ------------ +支持 VisionOS (4.1.0 或更高版本) | 网格渐变背景 (5.3.0 或更高版本) + +## 示例 +路径: `./Demo` (Xcode 项目) + +## 版本 +![GitHub release (latest by date)](https://img.shields.io/github/v/release/1998code/SwiftNEWKit?color=g&label=稳定版&style=for-the-badge) +![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/1998code/SwiftNEWKit?color=green&include_prereleases&label=测试版&style=for-the-badge) + +![swiftui-128x128_2x](https://user-images.githubusercontent.com/54872601/173193069-2eb486b0-1347-4448-ac2b-235b8f2f1bb0.png) + +## 测试平台和环境 +### 本地 +测试平台 | 最新版本 | 兼容版本 +-------- | ------ | ---------- +iOS | 18.4 | > 14 +iPadOS | 18.2 | > 14 +macOS | 15.2 | > 11 +visionOS | 2 | > 1 +### 云端 +测试平台 | 兼容版本 +-------- | ---------- +Xcode | > 13.4 (13F17a) +macOS | > 12.3.1 (21E258) + +### 设置 +步骤 | 描述 | 截图 +------| ----------- | ---------- +1 | 导航到根项目 | CleanShot 2022-06-11 at 17 39 39@2x +2 | 选择项目 | CleanShot 2022-06-11 at 17 39 48@2x +3 | 选择包依赖项 | CleanShot 2022-06-11 at 17 39 53@2x +4 | 点击 + 并粘贴 https://github.com/1998code/SwiftNEWKit 到搜索框 | CleanShot 2022-06-11 at 17 39 32@2x +5L | 创建一个名为 `data.json` 的新本地文件 | 您可以复制这个 [JSON 示例](https://github.com/1998code/SwiftNEWKit#sample)。 +5R | 您也可以使用远程 JSON / firebase 实时数据库。 | 示例: https://testground-a937f-default-rtdb.firebaseio.com/0.json?print=pretty + +### 主要用法 +1. 导入包。 +```swift +import SwiftNEW +``` + +2. 在 `body` 或任何 `some View` 之前添加状态。 +### 状态 +变量 | 建议值 | 选项 | 类型 +----------- | ------------------------------ | ----------------------------- | ---- +showNew * | false | false, true | Bool +align | .center | .leading, .center, .trailing | HorizontalAlignment +color | .accentColor | 支持所有颜色 | Color +size | "simple" | "invisible", "mini", "simple" | String +labelColor | UIColor.systemBackground 或 NSColor.windowBackgroundColor | 支持所有颜色 | Color +label | "显示发布说明" | 所有字符串 | String +labelImage | "arrow.up.circle.fill" | 所有 SF 符号 | String +history | true | true, false | Bool +data | "data" 或 "https://.../{}.json"| "{本地JSON文件}" 或 远程 | String +showDrop | false | false, true | Bool +mesh | true | false, true | Bool + +##### 示例: +```swift +// 必需 +@State var showNew: Bool = false + +// 可选 (5.2.0 或更高版本) +@State var align: HorizontalAlignment = .center +@State var color: Color = .accentColor +@State var size: String = "normal" +#if os(iOS) +@State var labelColor: Color = Color(UIColor.systemBackground) +#elseif os(macOS) +@State var labelColor: Color = Color(NSColor.windowBackgroundColor) +#endif +@State var label: String = "显示发布说明" +@State var labelImage: String = "arrow.up.circle.fill" +@State var history: Bool = true +@State var data: String = "data" +@State var showDrop: Bool = false +@State var mesh: Bool = false +``` + +3. 然后,将此代码粘贴到 `body` 或任何 `some View` 内部。 +```swift +// 5.2.0 或更高版本中使用默认选项的简化版本 +SwiftNEW(show: $showNew) + +// 5.1.0 或更低版本 +SwiftNEW(show: $showNew, align: $align, color: $color, size: $size, labelColor: $labelColor, label: $label, labelImage: $labelImage, history: $history, data: $data, showDrop: $showDrop) +``` +除了使用单独的状态外,内联状态也可以工作。(5.2.0 后不再需要) + +*`Show Bool` 不能内联。 +```swift +SwiftNEW(show: $showNew, align: .constant(.center), color: .constant(.accentColor), size: .constant("normal"), labelColor: .constant(Color(UIColor.systemBackground)), label: .constant("显示发布说明"), labelImage: .constant("arrow.up.circle.fill"), history: .constant(true), data: .constant("data"), showDrop: .constant(false)) +``` + +4. 您的代码应类似于以下内容,包含最小功能和默认样式。 +```swift +struct ContentView: View { + @State var showNew: Bool = false + var body: some View { + SwiftNEW(show: $showNew) + } +} +``` + +### JSON +#### 结构 / 模型 (参考) +* 以下代码仅供参考。您不需要复制结构或模型。 +```swift +public struct Vmodel: Codable, Hashable { + var version: String + var new: [Model] +} +public struct Model: Codable, Hashable { + var icon: String + var title: String + var subtitle: String + var body: String +} +``` + +#### 示例 +将 JSON 示例复制到 `data.json` 文件中(如果您没有该文件,请创建一个新文件。) + +![68747470733a2f2f76616c696461746f722e737761676765722e696f2f76616c696461746f723f75726c3d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f4f41492f4f70656e4150492d53706563696669636174696f6e2f6d61737465722f6578616d706c65732f76](https://user-images.githubusercontent.com/54872601/173190828-8ee763b9-4e33-4231-92ac-eb81b556c462.png) +```json +[ + { + "version": "1.2", + "new": [ + { + "body": "适用于 iOS 16, iPadOS 16, macOS 13", + "icon": "hammer.fill", + "subtitle": "修复UI问题", + "title": "错误修复" + }, + { + "body": "通过远程存储直接加载。很简单!", + "icon": "square.and.arrow.down.fill", + "subtitle": "已支持", + "title": "Firebase 远程" + }, + { + "body": "免费开源!由 Ming 用 ❤️‍🔥 创建", + "icon": "macpro.gen3.server", + "subtitle": "设计", + "title": "无服务器" + }, + { + "body": "提交拉取请求,让它对每个人都更好!", + "icon": "arrow.triangle.pull", + "subtitle": "一起", + "title": "贡献" + } + ] + }, + { + "version": "1.1", + "new": [ + { + "body": "适用于 iOS 16, iPadOS 16, macOS 13", + "icon": "hammer.fill", + "subtitle": "修复UI问题", + "title": "错误修复" + }, + { + "body": "通过本地存储直接加载。超快速!", + "icon": "square.and.arrow.down.fill", + "subtitle": "已支持", + "title": "本地文件" + }, + { + "body": "免费开源!由 Ming 用 ❤️‍🔥 创建", + "icon": "macpro.gen3.server", + "subtitle": "设计", + "title": "无服务器" + }, + { + "body": "提交拉取请求,让它对每个人都更好!", + "icon": "arrow.triangle.pull", + "subtitle": "一起", + "title": "贡献" + } + ] + } +] +``` + +## 贡献 + +欢迎对 SwiftNEW 做出贡献! + +- 要报告错误或请求功能,请在 GitHub 上提出问题 +- 提交拉取请求时,请遵循项目的编码风格 + +## 许可证 + +MIT。 详情请阅读 LICENSE 文件。 + +## 翻译 + +本文档还有其他语言版本: + +[English](../README.md) | 简中 / [繁中](README_tc.md) / [粵語](README_hc.md) | [日本語](README_ja.md) | [한국어](README_ko.md) + +请随时提交拉取请求,添加新语言或修复任何错别字/错误。 + +## 支持 + + + \ No newline at end of file From 532bcfad83f9e8deacd7b01b7effef41cf7d1d70 Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sat, 17 May 2025 15:01:24 +0800 Subject: [PATCH 14/23] Update accessibility --- README.md | 2 +- README/README_hc.md | 2 +- README/README_ja.md | 2 +- README/README_ko.md | 2 +- README/README_tc.md | 2 +- README/README_zh.md | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ac4de87..01b391c 100644 --- a/README.md +++ b/README.md @@ -241,5 +241,5 @@ Please feel free to open a pull request and add new language(s) or fix any typos ## Supported By - + Digital Ocean Logo diff --git a/README/README_hc.md b/README/README_hc.md index 83408b2..8585c5f 100644 --- a/README/README_hc.md +++ b/README/README_hc.md @@ -240,5 +240,5 @@ MIT。 詳情請閱讀 LICENSE 文件。 ## 支持 - + Digital Ocean 標誌 \ No newline at end of file diff --git a/README/README_ja.md b/README/README_ja.md index 4e2fb48..13bffb6 100644 --- a/README/README_ja.md +++ b/README/README_ja.md @@ -240,5 +240,5 @@ MIT。詳細については LICENSE ファイルをお読みください。 ## サポート - + Digital Ocean ロゴ \ No newline at end of file diff --git a/README/README_ko.md b/README/README_ko.md index 57eb7a7..81a6fad 100644 --- a/README/README_ko.md +++ b/README/README_ko.md @@ -240,5 +240,5 @@ MIT. 자세한 내용은 LICENSE 파일을 참조하세요. ## 지원 - + Digital Ocean 로고 \ No newline at end of file diff --git a/README/README_tc.md b/README/README_tc.md index fbb8fe3..190f164 100644 --- a/README/README_tc.md +++ b/README/README_tc.md @@ -240,5 +240,5 @@ MIT。 詳情請閱讀 LICENSE 文件。 ## 支持 - + Digital Ocean 標誌 \ No newline at end of file diff --git a/README/README_zh.md b/README/README_zh.md index ee06a69..9fa1aab 100644 --- a/README/README_zh.md +++ b/README/README_zh.md @@ -240,5 +240,5 @@ MIT。 详情请阅读 LICENSE 文件。 ## 支持 - + Digital Ocean 標誌 \ No newline at end of file From b2d8c93545c7046bb81d94616bb043fc730a227d Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sat, 17 May 2025 18:24:11 +0800 Subject: [PATCH 15/23] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 01b391c..101d82d 100644 --- a/README.md +++ b/README.md @@ -243,3 +243,7 @@ Please feel free to open a pull request and add new language(s) or fix any typos Digital Ocean Logo +
+
+ +[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/1998code/SwiftNEWKit) From 8e5031056101255f4e051df67f640e4bdfc3d2c4 Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sun, 18 May 2025 16:06:40 +0800 Subject: [PATCH 16/23] Update Demo/What's New?.xcodeproj/project.pbxproj Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- Demo/What's New?.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demo/What's New?.xcodeproj/project.pbxproj b/Demo/What's New?.xcodeproj/project.pbxproj index c3ce9e8..a0363ec 100644 --- a/Demo/What's New?.xcodeproj/project.pbxproj +++ b/Demo/What's New?.xcodeproj/project.pbxproj @@ -332,7 +332,7 @@ SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,7"; - XROS_DEPLOYMENT_TARGET = 1.0; + VISIONOS_DEPLOYMENT_TARGET = 1.0; }; name = Debug; }; From e88ceb50e213841617bfd4c88236f40b6994b95e Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sun, 18 May 2025 16:06:54 +0800 Subject: [PATCH 17/23] Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 101d82d..8f607fa 100644 --- a/README.md +++ b/README.md @@ -235,7 +235,7 @@ MIT. Read the LICENSE file for details. This doc is also available in: -English | [繁中](/README/README_tc.md) / [简中](/README/README_zh.md) / [粵語](/README/README_hc.md) | [日本語](/README/README_ja.md) | [한국어](/README/README_ko.md) +English | [繁中](README/README_tc.md) / [简中](README/README_zh.md) / [粵語](README/README_hc.md) | [日本語](README/README_ja.md) | [한국어](README/README_ko.md) Please feel free to open a pull request and add new language(s) or fix any typos/mistakes. From 6e86dd6f41b79b39b287ab909556637ad6151982 Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sun, 18 May 2025 20:46:10 +0800 Subject: [PATCH 18/23] Support tvOS --- Demo/What's New?.xcodeproj/project.pbxproj | 10 ++- Demo/What's New?/ContentView.swift | 29 ++------ Demo/What's New?/What_s_New_App.swift | 3 +- Package.swift | 3 +- Sources/SwiftNEW/Styles/MeshView.swift | 2 +- Sources/SwiftNEW/SwiftNEW.swift | 86 ++++++++++++++++++---- 6 files changed, 91 insertions(+), 42 deletions(-) diff --git a/Demo/What's New?.xcodeproj/project.pbxproj b/Demo/What's New?.xcodeproj/project.pbxproj index a0363ec..46282ce 100644 --- a/Demo/What's New?.xcodeproj/project.pbxproj +++ b/Demo/What's New?.xcodeproj/project.pbxproj @@ -325,13 +325,14 @@ PRODUCT_BUNDLE_IDENTIFIER = io.startway.WhatsNew; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; - SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; + SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator"; SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2,7"; + TARGETED_DEVICE_FAMILY = "1,2,3,7"; + TVOS_DEPLOYMENT_TARGET = 17.0; VISIONOS_DEPLOYMENT_TARGET = 1.0; }; name = Debug; @@ -361,13 +362,14 @@ PRODUCT_BUNDLE_IDENTIFIER = io.startway.WhatsNew; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; - SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; + SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator"; SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2,7"; + TARGETED_DEVICE_FAMILY = "1,2,3,7"; + TVOS_DEPLOYMENT_TARGET = 17.0; XROS_DEPLOYMENT_TARGET = 1.0; }; name = Release; diff --git a/Demo/What's New?/ContentView.swift b/Demo/What's New?/ContentView.swift index 65da0ad..7ea996b 100644 --- a/Demo/What's New?/ContentView.swift +++ b/Demo/What's New?/ContentView.swift @@ -8,9 +8,15 @@ import SwiftUI import SwiftNEW +struct ContentView : View { + @State var showNew: Bool = false + var body: some View { + SwiftNEW(show: $showNew) + } +} + #Preview("Default") { - @Previewable @State var showNew: Bool = false - SwiftNEW(show: $showNew) + ContentView() } // Mini (Toolbar / List only) @@ -39,22 +45,3 @@ import SwiftNEW @Previewable @State var showNew: Bool = false SwiftNEW(show: $showNew, label: .constant("Notification"), labelImage: .constant("bell.badge"), data: .constant("https://testground-a937f-default-rtdb.firebaseio.com/.json?print=pretty"), showDrop: .constant(true)) } - -// All States -// @State var showNew: Bool = false -// Optional -// @State var align: HorizontalAlignment = .center -// @State var color: Color = .accentColor -// @State var size: String = "simple" -// #if os(iOS) || os(visionOS) -// @State var labelColor: Color = Color(UIColor.systemBackground) -// #elseif os(macOS) -// @State var labelColor: Color = Color(NSColor.windowBackgroundColor) -// #endif -// @State var label: String = "Show Release Note" -// @State var labelImage: String = "arrow.up.circle.fill" -// @State var history: Bool = true -// @State var data: String = "data" -// @State var showDrop: Bool = false -// @State var mesh: Bool = true -// @State var specialEffect: String = "Christmas" diff --git a/Demo/What's New?/What_s_New_App.swift b/Demo/What's New?/What_s_New_App.swift index 177932e..b832626 100644 --- a/Demo/What's New?/What_s_New_App.swift +++ b/Demo/What's New?/What_s_New_App.swift @@ -11,8 +11,7 @@ import SwiftUI struct What_s_New_App: App { var body: some Scene { WindowGroup { -// ContentView() - Text("Demo") + ContentView() } } } diff --git a/Package.swift b/Package.swift index 31bdfa0..0489370 100644 --- a/Package.swift +++ b/Package.swift @@ -13,7 +13,8 @@ let package = Package( .iOS(.v15), .watchOS(.v8), .macOS(.v14), - .visionOS(.v1) + .visionOS(.v1), + .tvOS(.v17) ], products: [ .library( diff --git a/Sources/SwiftNEW/Styles/MeshView.swift b/Sources/SwiftNEW/Styles/MeshView.swift index e9a1fd4..a0aafd2 100644 --- a/Sources/SwiftNEW/Styles/MeshView.swift +++ b/Sources/SwiftNEW/Styles/MeshView.swift @@ -10,7 +10,7 @@ import SwiftUI struct MeshView: View { @Binding var color: Color var body: some View { - if #available(iOS 18.0, macOS 15.0, visionOS 2.0, *) { + if #available(iOS 18.0, macOS 15.0, visionOS 2.0, tvOS 18.0, *) { MeshGradient(width: 3, height: 3, points: [ .init(0, 0), .init(0.5, 0), .init(1, 0), .init(0, 0.5), .init(0.5, 0.5), .init(1, 0.5), diff --git a/Sources/SwiftNEW/SwiftNEW.swift b/Sources/SwiftNEW/SwiftNEW.swift index 7543432..b8a09fc 100644 --- a/Sources/SwiftNEW/SwiftNEW.swift +++ b/Sources/SwiftNEW/SwiftNEW.swift @@ -10,7 +10,7 @@ import SwiftGlass import Drops #endif -@available(iOS 15, watchOS 8.0, macOS 12.0, *) +@available(iOS 15.0, watchOS 8.0, macOS 12.0, tvOS 17.0, *) public struct SwiftNEW: View { @AppStorage("version") var version = 1.0 @AppStorage("build") var build: Double = 1 @@ -90,6 +90,35 @@ public struct SwiftNEW: View { _specialEffect = specialEffect ?? .constant("") compareVersion() } + #else + public init( + show: Binding, + align: Binding? = .constant(.center), + color: Binding? = .constant(Color.accentColor), + size: Binding? = .constant("simple"), + labelColor: Binding? = .constant(Color.white), + label: Binding? = .constant("Show Release Note"), + labelImage: Binding? = .constant("arrow.up.circle.fill"), + history: Binding? = .constant(true), + data: Binding? = .constant("data"), + showDrop: Binding? = .constant(false), + mesh: Binding? = .constant(true), + specialEffect: Binding? = .constant("") + ) { + _show = show + _align = align ?? .constant(.center) + _color = color ?? .constant(Color.accentColor) + _size = size ?? .constant("simple") + _labelColor = labelColor ?? .constant(Color.white) + _label = label ?? .constant("Show Release Note") + _labelImage = labelImage ?? .constant("arrow.up.circle.fill") + _history = history ?? .constant(true) + _data = data ?? .constant("data") + _showDrop = showDrop ?? .constant(false) + _mesh = mesh ?? .constant(true) + _specialEffect = specialEffect ?? .constant("") + compareVersion() + } #endif public var body: some View { @@ -107,7 +136,11 @@ public struct SwiftNEW: View { } else if size == "normal" || size == "simple" { Label(label, systemImage: labelImage) + #if !os(tvOS) .frame(width: 300, height: 50) + #else + .frame(width: 400, height: 50) + #endif #if os(iOS) && !os(visionOS) .foregroundColor(labelColor) .background(color) @@ -127,7 +160,7 @@ public struct SwiftNEW: View { } sheetCurrent .sheet(isPresented: $historySheet) { - if #available(iOS 16.4, *) { + if #available(iOS 16.4, tvOS 16.4, *) { sheetHistory .presentationBackground(.thinMaterial) } else { @@ -170,7 +203,11 @@ public struct SwiftNEW: View { Image(systemName: new.icon) .foregroundColor(.white) }.glass(radius: 15, shadowColor: color) - .frame(width: 50, height:50) + #if !os(tvOS) + .frame(width: 50, height: 50) + #else + .frame(width: 100, height: 100) + #endif .cornerRadius(15) .padding(.trailing) } else { @@ -189,7 +226,11 @@ public struct SwiftNEW: View { Image(systemName: new.icon) .foregroundColor(.white) }.glass(radius: 15, shadowColor: color) - .frame(width: 50, height:50) + #if !os(tvOS) + .frame(width: 50, height: 50) + #else + .frame(width: 100, height: 100) + #endif .cornerRadius(15) .padding(.trailing) } else { @@ -199,7 +240,10 @@ public struct SwiftNEW: View { } } } - }.frame(width: 300) + } + #if !os(tvOS) + .frame(width: 300) + #endif .frame(maxHeight: UIScreen.main.bounds.height * 0.5) } @@ -216,10 +260,12 @@ public struct SwiftNEW: View { .onAppear { loadData() } -#if os(macOS) - .padding(25) + #if os(macOS) + .padding() .frame(width: 600, height: 600) -#endif + #elseif os(tvOS) + .frame(width: 600) + #endif } #if os(iOS) public var headings: some View { @@ -243,7 +289,7 @@ public struct SwiftNEW: View { } } } - #elseif os(macOS) || os(visionOS) + #elseif os(macOS) || os(visionOS) || os(tvOS) public var headings: some View { VStack { Text(String(localized: "What's New in", bundle: .module)) @@ -298,6 +344,8 @@ public struct SwiftNEW: View { .foregroundColor(.white) .background(color) .cornerRadius(15) + #elseif os(tvOS) + .tint(.white) #endif }.glass(shadowColor: color) } @@ -330,7 +378,11 @@ public struct SwiftNEW: View { Image(systemName: new.icon) .foregroundColor(.white) }.glass(radius: 15, shadowColor: color) - .frame(width: 50, height:50) + #if !os(tvOS) + .frame(width: 50, height: 50) + #else + .frame(width: 100, height: 100) + #endif .cornerRadius(15) .padding(.trailing) } else { @@ -349,7 +401,11 @@ public struct SwiftNEW: View { Image(systemName: new.icon) .foregroundColor(.white) } - .frame(width: 50, height:50) + #if !os(tvOS) + .frame(width: 50, height: 50) + #else + .frame(width: 100, height: 100) + #endif .cornerRadius(15) .padding(.leading) } else { @@ -358,8 +414,10 @@ public struct SwiftNEW: View { }.padding(.bottom) } } - }.frame(width: 300) -// .frame(maxHeight: 450) + } + #if !os(tvOS) + .frame(width: 300) + #endif .frame(maxHeight: UIScreen.main.bounds.height * 0.6) Spacer() @@ -370,6 +428,8 @@ public struct SwiftNEW: View { #if os(macOS) .padding() .frame(width: 600, height: 600) + #elseif os(tvOS) + .frame(width: 600) #endif } public var closeHistoryButton: some View { From b73dcc02e1ce4c3852fc1777af5c64ac1bdeb3eb Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sun, 18 May 2025 20:48:19 +0800 Subject: [PATCH 19/23] Fix macOS --- Sources/SwiftNEW/SwiftNEW.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/SwiftNEW/SwiftNEW.swift b/Sources/SwiftNEW/SwiftNEW.swift index b8a09fc..9f65479 100644 --- a/Sources/SwiftNEW/SwiftNEW.swift +++ b/Sources/SwiftNEW/SwiftNEW.swift @@ -243,8 +243,9 @@ public struct SwiftNEW: View { } #if !os(tvOS) .frame(width: 300) - #endif + #elseif !os(macOS) .frame(maxHeight: UIScreen.main.bounds.height * 0.5) + #endif } Spacer() @@ -417,8 +418,9 @@ public struct SwiftNEW: View { } #if !os(tvOS) .frame(width: 300) + #elseif !os(macOS) + .frame(maxHeight: UIScreen.main.bounds.height * 0.5) #endif - .frame(maxHeight: UIScreen.main.bounds.height * 0.6) Spacer() From 6845b918c089cf8e8d92f7a5756b2951c2875a64 Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sun, 18 May 2025 20:58:46 +0800 Subject: [PATCH 20/23] Add Japanese and Korean --- Demo/What's New?.xcodeproj/project.pbxproj | 6 + Demo/What's New?/en.lproj/data.json | 48 ----- Demo/What's New?/ja.lproj/data.json | 230 +++++++++++++++++++++ Demo/What's New?/ko.lproj/data.json | 230 +++++++++++++++++++++ Demo/What's New?/zh-Hans.lproj/data.json | 48 ----- Demo/What's New?/zh-Hant.lproj/data.json | 36 ---- 6 files changed, 466 insertions(+), 132 deletions(-) create mode 100644 Demo/What's New?/ja.lproj/data.json create mode 100644 Demo/What's New?/ko.lproj/data.json diff --git a/Demo/What's New?.xcodeproj/project.pbxproj b/Demo/What's New?.xcodeproj/project.pbxproj index 46282ce..94508a6 100644 --- a/Demo/What's New?.xcodeproj/project.pbxproj +++ b/Demo/What's New?.xcodeproj/project.pbxproj @@ -17,6 +17,8 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 3A1D311B2DDA0F8900A67C5E /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.json; name = ja; path = ja.lproj/data.json; sourceTree = ""; }; + 3A1D311C2DDA0F9000A67C5E /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.json; name = ko; path = ko.lproj/data.json; sourceTree = ""; }; 3A2BBE7B2D18129000A7CAF9 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.json; name = "zh-Hans"; path = "zh-Hans.lproj/data.json"; sourceTree = ""; }; 3A46CBAC285444CC00BE79A3 /* What's New?.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "What's New?.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 3A46CBAF285444CC00BE79A3 /* What_s_New_App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = What_s_New_App.swift; sourceTree = ""; }; @@ -136,6 +138,8 @@ Base, "zh-Hant", "zh-Hans", + ja, + ko, ); mainGroup = 3A46CBA3285444CC00BE79A3; packageReferences = ( @@ -182,6 +186,8 @@ 3AE0026B2962DD540055979A /* en */, 3AE0026D2962DD810055979A /* zh-Hant */, 3A2BBE7B2D18129000A7CAF9 /* zh-Hans */, + 3A1D311B2DDA0F8900A67C5E /* ja */, + 3A1D311C2DDA0F9000A67C5E /* ko */, ); name = data.json; sourceTree = ""; diff --git a/Demo/What's New?/en.lproj/data.json b/Demo/What's New?/en.lproj/data.json index a4eca6f..cccc5d7 100644 --- a/Demo/What's New?/en.lproj/data.json +++ b/Demo/What's New?/en.lproj/data.json @@ -162,18 +162,6 @@ "title": "Layout", "subtitle": "Fixed", "body": "on iOS Landscape." - }, - { - "icon": "macpro.gen3.server", - "title": "Serverless", - "subtitle": "Design", - "body": "Free and open source! Created by Ming with ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "Contribute", - "subtitle": "Together", - "body": "Pull requests and make it better for everyone!" } ] }, @@ -185,18 +173,6 @@ "title": "Crash", "subtitle": "Fixed", "body": "on macOS." - }, - { - "icon": "macpro.gen3.server", - "title": "Serverless", - "subtitle": "Design", - "body": "Free and open source! Created by Ming with ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "Contribute", - "subtitle": "Together", - "body": "Pull requests and make it better for everyone!" } ] }, @@ -208,18 +184,6 @@ "title": "Remote Drop", "subtitle": "Supported", "body": "Instead of full page sheet, you can use a small drop too!" - }, - { - "icon": "macpro.gen3.server", - "title": "Serverless", - "subtitle": "Design", - "body": "Free and open source! Created by Ming with ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "Contribute", - "subtitle": "Together", - "body": "Pull requests and make it better for everyone!" } ] }, @@ -231,18 +195,6 @@ "title": "Remote File", "subtitle": "Supported", "body": "Direct load via remote storage. Easy!" - }, - { - "icon": "macpro.gen3.server", - "title": "Serverless", - "subtitle": "Design", - "body": "Free and open source! Created by Ming with ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "Contribute", - "subtitle": "Together", - "body": "Pull requests and make it better for everyone!" } ] }, diff --git a/Demo/What's New?/ja.lproj/data.json b/Demo/What's New?/ja.lproj/data.json new file mode 100644 index 0000000..bd2d4bb --- /dev/null +++ b/Demo/What's New?/ja.lproj/data.json @@ -0,0 +1,230 @@ +[ + { + "version": "6.0", + "subVersion": "6.0.0", + "new": [ + { + "icon": "wineglass", + "title": "ガラス", + "subtitle": "エフェクト", + "body": "近日公開予定!" + }, + { + "icon": "macpro.gen3.server", + "title": "サーバーレス", + "subtitle": "デザイン", + "body": "無料でオープンソース! ❤️‍🔥" + }, + { + "icon": "arrow.triangle.pull", + "title": "貢献", + "subtitle": "一緒に", + "body": "プルリクエストを送って、みんなのためにより良くしましょう! 🎉" + } + ] + }, + { + "version": "5.5", + "subVersion": "5.5.0", + "new": [ + { + "icon": "snowflake", + "title": "雪", + "subtitle": "エフェクト", + "body": "さらに特別なアニメーションが近日公開予定!" + } + ] + }, + { + "version": "5.4", + "subVersion": "5.4.0", + "new": [ + { + "icon": "pencil.tip", + "title": "メッシュ背景色", + "subtitle": "マッチング", + "body": "標準化されたデザイン。" + } + ] + }, + { + "version": "5.3", + "subVersion": "5.3.0", + "new": [ + { + "icon": "pencil.tip", + "title": "追加", + "subtitle": "メッシュ背景", + "body": "より良いスタイルとデザイン。" + } + ] + }, + { + "version": "5.2", + "subVersion": "5.2.0", + "new": [ + { + "icon": "hammer", + "title": "デフォルト", + "subtitle": "オプション", + "body": "より少ないコードのための新しいオプショナルバインディング。" + } + ] + }, + { + "version": "5.1", + "subVersion": "5.1.0", + "new": [ + { + "icon": "character.book.closed", + "title": "更新", + "subtitle": "デモ", + "body": "5.0バージョン用。" + } + ] + }, + { + "version": "5.0", + "subVersion": "5.0.0", + "new": [ + { + "icon": "character.book.closed", + "title": "サポート", + "subtitle": "ローカライゼーション", + "body": "Appleの文字列カタログを活用。" + }, + { + "icon": "pip.remove", + "title": "サポート", + "subtitle": "終了", + "body": "iOS14、watchOS7、およびmacOS11のサポートを終了。" + } + ] + }, + { + "version": "4.2", + "subVersion": "4.2.0", + "new": [ + { + "icon": "hammer", + "title": "マイナー", + "subtitle": "アップデート", + "body": "軽微なバグ修正とUI改善。" + } + ] + }, + { + "version": "4.1", + "subVersion": "4.1.0", + "new": [ + { + "icon": "eye", + "title": "Vision Proをサポート", + "subtitle": "& visionOS", + "body": "Dropsフレームワークは競合のため一時的に無効化されています。" + } + ] + }, + { + "version": "4.0", + "subVersion": "4.0.0", + "new": [ + { + "icon": "number", + "title": "より良い互換性", + "subtitle": "バージョンとビルド", + "body": "x.y.zまたはx.yの形式が使用可能になりました。" + } + ] + }, + { + "version": "3.9", + "new": [ + { + "icon": "app.fill", + "title": "アプリアイコン", + "subtitle": "対応", + "body": "iOSで。" + }, + { + "icon": "app", + "title": "デモ", + "subtitle": "改善", + "body": "パッケージのバージョンに従っています。" + } + ] + }, + { + "version": "1.5", + "new": [ + { + "icon": "hammer", + "title": "レイアウト", + "subtitle": "修正", + "body": "iOS横向き表示で。" + } + ] + }, + { + "version": "1.4", + "new": [ + { + "icon": "hammer", + "title": "クラッシュ", + "subtitle": "修正", + "body": "macOSで。" + } + ] + }, + { + "version": "1.3", + "new": [ + { + "icon": "bell.badge", + "title": "リモートドロップ", + "subtitle": "対応", + "body": "全画面シートの代わりに、小さなドロップも使用できるようになりました!" + } + ] + }, + { + "version": "1.2", + "new": [ + { + "icon": "square.and.arrow.down.fill", + "title": "リモートファイル", + "subtitle": "対応", + "body": "リモートストレージから直接ロード。簡単です!" + } + ] + }, + { + "version": "1.1", + "new": [ + { + "icon": "hammer.fill", + "title": "バグ修正", + "subtitle": "UI不具合", + "body": "iOS 16、iPadOS 16、macOS 13に対応" + }, + { + "icon": "square.and.arrow.down.fill", + "title": "ローカルファイル", + "subtitle": "対応", + "body": "ローカルストレージから直接ロード。超高速!" + }, + { + "icon": "macpro.gen3.server", + "title": "サーバーレス", + "subtitle": "デザイン", + "body": "無料でオープンソース!Mingが❤️‍🔥を込めて作成" + }, + { + "icon": "arrow.triangle.pull", + "title": "貢献", + "subtitle": "一緒に", + "body": "プルリクエストを送って、みんなのためにより良くしましょう!" + } + ] + } +] diff --git a/Demo/What's New?/ko.lproj/data.json b/Demo/What's New?/ko.lproj/data.json new file mode 100644 index 0000000..1838e9b --- /dev/null +++ b/Demo/What's New?/ko.lproj/data.json @@ -0,0 +1,230 @@ +[ + { + "version": "6.0", + "subVersion": "6.0.0", + "new": [ + { + "icon": "wineglass", + "title": "유리", + "subtitle": "효과", + "body": "곧 출시 예정!" + }, + { + "icon": "macpro.gen3.server", + "title": "서버리스", + "subtitle": "디자인", + "body": "무료 오픈 소스! ❤️‍🔥" + }, + { + "icon": "arrow.triangle.pull", + "title": "기여하기", + "subtitle": "함께", + "body": "풀 리퀘스트를 통해 모두를 위해 더 나아지게 만들어보세요! 🎉" + } + ] + }, + { + "version": "5.5", + "subVersion": "5.5.0", + "new": [ + { + "icon": "snowflake", + "title": "눈", + "subtitle": "효과", + "body": "더 많은 특별한 애니메이션이 곧 출시 예정!" + } + ] + }, + { + "version": "5.4", + "subVersion": "5.4.0", + "new": [ + { + "icon": "pencil.tip", + "title": "매치된", + "subtitle": "메쉬 배경 색상", + "body": "표준화된 디자인." + } + ] + }, + { + "version": "5.3", + "subVersion": "5.3.0", + "new": [ + { + "icon": "pencil.tip", + "title": "추가", + "subtitle": "메쉬 배경", + "body": "더 나은 스타일과 디자인." + } + ] + }, + { + "version": "5.2", + "subVersion": "5.2.0", + "new": [ + { + "icon": "hammer", + "title": "기본값", + "subtitle": "옵션", + "body": "더 적은 코드를 위한 새로운 옵셔널 바인딩." + } + ] + }, + { + "version": "5.1", + "subVersion": "5.1.0", + "new": [ + { + "icon": "character.book.closed", + "title": "업데이트", + "subtitle": "데모", + "body": "5.0 버전용." + } + ] + }, + { + "version": "5.0", + "subVersion": "5.0.0", + "new": [ + { + "icon": "character.book.closed", + "title": "지원", + "subtitle": "현지화", + "body": "Apple 문자열 카탈로그 기반." + }, + { + "icon": "pip.remove", + "title": "지원 중단", + "subtitle": "지원", + "body": "iOS14, watchOS7, macOS11에 대한 지원 중단." + } + ] + }, + { + "version": "4.2", + "subVersion": "4.2.0", + "new": [ + { + "icon": "hammer", + "title": "사소한", + "subtitle": "업데이트", + "body": "사소한 버그 수정 및 UI 개선." + } + ] + }, + { + "version": "4.1", + "subVersion": "4.1.0", + "new": [ + { + "icon": "eye", + "title": "Vision Pro 지원", + "subtitle": "및 visionOS", + "body": "충돌로 인해 Drops 프레임워크가 일시적으로 비활성화되었습니다." + } + ] + }, + { + "version": "4.0", + "subVersion": "4.0.0", + "new": [ + { + "icon": "number", + "title": "향상된 호환성", + "subtitle": "버전 및 빌드", + "body": "이제 x.y.z 또는 x.y 형식을 사용할 수 있습니다." + } + ] + }, + { + "version": "3.9", + "new": [ + { + "icon": "app.fill", + "title": "앱 아이콘", + "subtitle": "지원됨", + "body": "iOS에서." + }, + { + "icon": "app", + "title": "데모", + "subtitle": "더 좋아졌습니다", + "body": "패키지 버전을 따라갑니다." + } + ] + }, + { + "version": "1.5", + "new": [ + { + "icon": "hammer", + "title": "레이아웃", + "subtitle": "수정됨", + "body": "iOS 가로 모드에서." + } + ] + }, + { + "version": "1.4", + "new": [ + { + "icon": "hammer", + "title": "충돌", + "subtitle": "수정됨", + "body": "macOS에서." + } + ] + }, + { + "version": "1.3", + "new": [ + { + "icon": "bell.badge", + "title": "원격 드롭", + "subtitle": "지원됨", + "body": "전체 페이지 시트 대신 작은 드롭도 사용할 수 있습니다!" + } + ] + }, + { + "version": "1.2", + "new": [ + { + "icon": "square.and.arrow.down.fill", + "title": "원격 파일", + "subtitle": "지원됨", + "body": "원격 저장소를 통한 직접 로드. 간편합니다!" + } + ] + }, + { + "version": "1.1", + "new": [ + { + "icon": "hammer.fill", + "title": "버그 수정", + "subtitle": "UI 오류", + "body": "iOS 16, iPadOS 16, macOS 13에서 사용 가능" + }, + { + "icon": "square.and.arrow.down.fill", + "title": "로컬 파일", + "subtitle": "지원됨", + "body": "로컬 저장소를 통한 직접 로드. 초고속!" + }, + { + "icon": "macpro.gen3.server", + "title": "서버리스", + "subtitle": "디자인", + "body": "무료 오픈 소스! Ming이 ❤️‍🔥로 만들었습니다" + }, + { + "icon": "arrow.triangle.pull", + "title": "기여하기", + "subtitle": "함께", + "body": "풀 리퀘스트를 통해 모두를 위해 더 나아지게 만들어보세요!" + } + ] + } +] diff --git a/Demo/What's New?/zh-Hans.lproj/data.json b/Demo/What's New?/zh-Hans.lproj/data.json index a1ba236..88857f5 100644 --- a/Demo/What's New?/zh-Hans.lproj/data.json +++ b/Demo/What's New?/zh-Hans.lproj/data.json @@ -162,18 +162,6 @@ "title": "Layout", "subtitle": "Fixed", "body": "on iOS Landscape." - }, - { - "icon": "macpro.gen3.server", - "title": "Serverless", - "subtitle": "Design", - "body": "Free and open source! Created by Ming with ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "Contribute", - "subtitle": "Together", - "body": "Pull requests and make it better for everyone!" } ] }, @@ -185,18 +173,6 @@ "title": "Crash", "subtitle": "Fixed", "body": "on macOS." - }, - { - "icon": "macpro.gen3.server", - "title": "Serverless", - "subtitle": "Design", - "body": "Free and open source! Created by Ming with ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "Contribute", - "subtitle": "Together", - "body": "Pull requests and make it better for everyone!" } ] }, @@ -208,18 +184,6 @@ "title": "Remote Drop", "subtitle": "Supported", "body": "Instead of full page sheet, you can use a small drop too!" - }, - { - "icon": "macpro.gen3.server", - "title": "Serverless", - "subtitle": "Design", - "body": "Free and open source! Created by Ming with ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "Contribute", - "subtitle": "Together", - "body": "Pull requests and make it better for everyone!" } ] }, @@ -231,18 +195,6 @@ "title": "Remote File", "subtitle": "Supported", "body": "Direct load via remote storage. Easy!" - }, - { - "icon": "macpro.gen3.server", - "title": "Serverless", - "subtitle": "Design", - "body": "Free and open source! Created by Ming with ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "Contribute", - "subtitle": "Together", - "body": "Pull requests and make it better for everyone!" } ] }, diff --git a/Demo/What's New?/zh-Hant.lproj/data.json b/Demo/What's New?/zh-Hant.lproj/data.json index 8ac70f4..0f74761 100644 --- a/Demo/What's New?/zh-Hant.lproj/data.json +++ b/Demo/What's New?/zh-Hant.lproj/data.json @@ -185,18 +185,6 @@ "title": "Crash", "subtitle": "Fixed", "body": "on macOS." - }, - { - "icon": "macpro.gen3.server", - "title": "Serverless", - "subtitle": "Design", - "body": "Free and open source! Created by Ming with ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "Contribute", - "subtitle": "Together", - "body": "Pull requests and make it better for everyone!" } ] }, @@ -208,18 +196,6 @@ "title": "Remote Drop", "subtitle": "Supported", "body": "Instead of full page sheet, you can use a small drop too!" - }, - { - "icon": "macpro.gen3.server", - "title": "Serverless", - "subtitle": "Design", - "body": "Free and open source! Created by Ming with ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "Contribute", - "subtitle": "Together", - "body": "Pull requests and make it better for everyone!" } ] }, @@ -231,18 +207,6 @@ "title": "Remote File", "subtitle": "Supported", "body": "Direct load via remote storage. Easy!" - }, - { - "icon": "macpro.gen3.server", - "title": "Serverless", - "subtitle": "Design", - "body": "Free and open source! Created by Ming with ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "Contribute", - "subtitle": "Together", - "body": "Pull requests and make it better for everyone!" } ] }, From 31070b436ae66b94087fb2d22a626fc32f01c6e7 Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sun, 18 May 2025 20:59:55 +0800 Subject: [PATCH 21/23] Update data.json --- Demo/What's New?/zh-Hant.lproj/data.json | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Demo/What's New?/zh-Hant.lproj/data.json b/Demo/What's New?/zh-Hant.lproj/data.json index 0f74761..708cd46 100644 --- a/Demo/What's New?/zh-Hant.lproj/data.json +++ b/Demo/What's New?/zh-Hant.lproj/data.json @@ -162,18 +162,6 @@ "title": "Layout", "subtitle": "Fixed", "body": "on iOS Landscape." - }, - { - "icon": "macpro.gen3.server", - "title": "Serverless", - "subtitle": "Design", - "body": "Free and open source! Created by Ming with ❤️‍🔥" - }, - { - "icon": "arrow.triangle.pull", - "title": "Contribute", - "subtitle": "Together", - "body": "Pull requests and make it better for everyone!" } ] }, From fe6d98add2716568947d63fd0b13357d7c5328c6 Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sun, 18 May 2025 21:01:11 +0800 Subject: [PATCH 22/23] Update README.md --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 8f607fa..eb57a39 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,6 @@ | Firebase Real-Time Database | 3.0.0 | | Remote JSON File | 3.0.0 | | Versioning + View History | 2.0.0 | -| Allows for ALL Use Cases including Commercial / Non-profit | - | -| Simple Model, Easy to Modify and Reuse | - | -| Simple Binding and Passing Data | - | -| Instant Loading from Local Storage | - | ## Preview ![CleanShot 2022-06-11 at 22 54 15@2x](https://user-images.githubusercontent.com/54872601/173192927-ca2a8bef-2114-44f8-8d4d-47baadb8b4a8.png) From f85aef8e9094cb81332d4c2ec6680ce9b3714e26 Mon Sep 17 00:00:00 2001 From: MING <54872601+1998code@users.noreply.github.com> Date: Sun, 18 May 2025 21:04:02 +0800 Subject: [PATCH 23/23] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index eb57a39..3967e07 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +SNK + # SwiftNEW ![image](https://github.com/user-attachments/assets/0a5de416-f4cd-41b5-8060-f839f2e7286a)