Skip to content

Commit 09f9b5b

Browse files
committed
4.0 Update
1 parent 37e6e33 commit 09f9b5b

File tree

7 files changed

+182
-27
lines changed

7 files changed

+182
-27
lines changed

Demo/What's New?.xcodeproj/project.pbxproj

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 56;
6+
objectVersion = 60;
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
3A23CAF52A3AC05C0099CC42 /* SwiftNEW in Frameworks */ = {isa = PBXBuildFile; productRef = 3A23CAF42A3AC05C0099CC42 /* SwiftNEW */; };
1011
3A46CBB0285444CC00BE79A3 /* What_s_New_App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A46CBAF285444CC00BE79A3 /* What_s_New_App.swift */; };
1112
3A46CBB2285444CC00BE79A3 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A46CBB1285444CC00BE79A3 /* ContentView.swift */; };
1213
3A46CBB4285444CD00BE79A3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3A46CBB3285444CD00BE79A3 /* Assets.xcassets */; };
1314
3A46CBB8285444CD00BE79A3 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3A46CBB7285444CD00BE79A3 /* Preview Assets.xcassets */; };
1415
3AB7E09128630E380059EEFE /* SwiftNEW in Frameworks */ = {isa = PBXBuildFile; productRef = 3AB7E09028630E380059EEFE /* SwiftNEW */; };
1516
3AE0026A2962DD540055979A /* data.json in Resources */ = {isa = PBXBuildFile; fileRef = 3AE0026C2962DD540055979A /* data.json */; };
16-
3AE7A52728BDB0BF00B4789E /* SwiftNEW in Frameworks */ = {isa = PBXBuildFile; productRef = 3AE7A52628BDB0BF00B4789E /* SwiftNEW */; };
1717
/* End PBXBuildFile section */
1818

1919
/* Begin PBXFileReference section */
@@ -34,7 +34,7 @@
3434
buildActionMask = 2147483647;
3535
files = (
3636
3AB7E09128630E380059EEFE /* SwiftNEW in Frameworks */,
37-
3AE7A52728BDB0BF00B4789E /* SwiftNEW in Frameworks */,
37+
3A23CAF52A3AC05C0099CC42 /* SwiftNEW in Frameworks */,
3838
);
3939
runOnlyForDeploymentPostprocessing = 0;
4040
};
@@ -105,7 +105,7 @@
105105
name = "What's New?";
106106
packageProductDependencies = (
107107
3AB7E09028630E380059EEFE /* SwiftNEW */,
108-
3AE7A52628BDB0BF00B4789E /* SwiftNEW */,
108+
3A23CAF42A3AC05C0099CC42 /* SwiftNEW */,
109109
);
110110
productName = "What's New?";
111111
productReference = 3A46CBAC285444CC00BE79A3 /* What's New?.app */;
@@ -137,7 +137,7 @@
137137
);
138138
mainGroup = 3A46CBA3285444CC00BE79A3;
139139
packageReferences = (
140-
3AE7A52528BDB0BF00B4789E /* XCRemoteSwiftPackageReference "SwiftNEWKit" */,
140+
3A23CAF32A3AC05C0099CC42 /* XCLocalSwiftPackageReference ".." */,
141141
);
142142
productRefGroup = 3A46CBAD285444CC00BE79A3 /* Products */;
143143
projectDirPath = "";
@@ -304,7 +304,7 @@
304304
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
305305
CODE_SIGN_ENTITLEMENTS = "What's New?/What_s_New_.entitlements";
306306
CODE_SIGN_STYLE = Automatic;
307-
CURRENT_PROJECT_VERSION = 6;
307+
CURRENT_PROJECT_VERSION = 7;
308308
DEVELOPMENT_ASSET_PATHS = "\"What's New?/Preview Content\"";
309309
DEVELOPMENT_TEAM = "";
310310
ENABLE_HARDENED_RUNTIME = YES;
@@ -318,7 +318,7 @@
318318
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
319319
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
320320
MACOSX_DEPLOYMENT_TARGET = 11.0;
321-
MARKETING_VERSION = 3.9;
321+
MARKETING_VERSION = 4.0.0;
322322
PRODUCT_BUNDLE_IDENTIFIER = io.startway.WhatsNew;
323323
PRODUCT_NAME = "$(TARGET_NAME)";
324324
SDKROOT = auto;
@@ -336,7 +336,7 @@
336336
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
337337
CODE_SIGN_ENTITLEMENTS = "What's New?/What_s_New_.entitlements";
338338
CODE_SIGN_STYLE = Automatic;
339-
CURRENT_PROJECT_VERSION = 6;
339+
CURRENT_PROJECT_VERSION = 7;
340340
DEVELOPMENT_ASSET_PATHS = "\"What's New?/Preview Content\"";
341341
DEVELOPMENT_TEAM = "";
342342
ENABLE_HARDENED_RUNTIME = YES;
@@ -350,7 +350,7 @@
350350
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
351351
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
352352
MACOSX_DEPLOYMENT_TARGET = 11.0;
353-
MARKETING_VERSION = 3.9;
353+
MARKETING_VERSION = 4.0.0;
354354
PRODUCT_BUNDLE_IDENTIFIER = io.startway.WhatsNew;
355355
PRODUCT_NAME = "$(TARGET_NAME)";
356356
SDKROOT = auto;
@@ -384,25 +384,20 @@
384384
};
385385
/* End XCConfigurationList section */
386386

387-
/* Begin XCRemoteSwiftPackageReference section */
388-
3AE7A52528BDB0BF00B4789E /* XCRemoteSwiftPackageReference "SwiftNEWKit" */ = {
389-
isa = XCRemoteSwiftPackageReference;
390-
repositoryURL = "https://github.com/1998code/SwiftNEWKit";
391-
requirement = {
392-
branch = main;
393-
kind = branch;
394-
};
387+
/* Begin XCLocalSwiftPackageReference section */
388+
3A23CAF32A3AC05C0099CC42 /* XCLocalSwiftPackageReference ".." */ = {
389+
isa = XCLocalSwiftPackageReference;
390+
relativePath = ..;
395391
};
396-
/* End XCRemoteSwiftPackageReference section */
392+
/* End XCLocalSwiftPackageReference section */
397393

398394
/* Begin XCSwiftPackageProductDependency section */
399-
3AB7E09028630E380059EEFE /* SwiftNEW */ = {
395+
3A23CAF42A3AC05C0099CC42 /* SwiftNEW */ = {
400396
isa = XCSwiftPackageProductDependency;
401397
productName = SwiftNEW;
402398
};
403-
3AE7A52628BDB0BF00B4789E /* SwiftNEW */ = {
399+
3AB7E09028630E380059EEFE /* SwiftNEW */ = {
404400
isa = XCSwiftPackageProductDependency;
405-
package = 3AE7A52528BDB0BF00B4789E /* XCRemoteSwiftPackageReference "SwiftNEWKit" */;
406401
productName = SwiftNEW;
407402
};
408403
/* End XCSwiftPackageProductDependency section */

Demo/What's New?.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1400"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "3A46CBAB285444CC00BE79A3"
18+
BuildableName = "What&apos;s New?.app"
19+
BlueprintName = "What&apos;s New?"
20+
ReferencedContainer = "container:What&apos;s New?.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37+
launchStyle = "0"
38+
useCustomWorkingDirectory = "NO"
39+
ignoresPersistentStateOnLaunch = "NO"
40+
debugDocumentVersioning = "YES"
41+
debugServiceExtension = "internal"
42+
allowLocationSimulation = "YES">
43+
<BuildableProductRunnable
44+
runnableDebuggingMode = "0">
45+
<BuildableReference
46+
BuildableIdentifier = "primary"
47+
BlueprintIdentifier = "3A46CBAB285444CC00BE79A3"
48+
BuildableName = "What&apos;s New?.app"
49+
BlueprintName = "What&apos;s New?"
50+
ReferencedContainer = "container:What&apos;s New?.xcodeproj">
51+
</BuildableReference>
52+
</BuildableProductRunnable>
53+
</LaunchAction>
54+
<ProfileAction
55+
buildConfiguration = "Release"
56+
shouldUseLaunchSchemeArgsEnv = "YES"
57+
savedToolIdentifier = ""
58+
useCustomWorkingDirectory = "NO"
59+
debugDocumentVersioning = "YES">
60+
<BuildableProductRunnable
61+
runnableDebuggingMode = "0">
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "3A46CBAB285444CC00BE79A3"
65+
BuildableName = "What&apos;s New?.app"
66+
BlueprintName = "What&apos;s New?"
67+
ReferencedContainer = "container:What&apos;s New?.xcodeproj">
68+
</BuildableReference>
69+
</BuildableProductRunnable>
70+
</ProfileAction>
71+
<AnalyzeAction
72+
buildConfiguration = "Debug">
73+
</AnalyzeAction>
74+
<ArchiveAction
75+
buildConfiguration = "Release"
76+
revealArchiveInOrganizer = "YES">
77+
</ArchiveAction>
78+
</Scheme>

Demo/What's New?/ContentView.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,12 @@ struct ContentView: View {
3333
}
3434

3535
var mini: some View {
36-
// MARK: Mini (Toolbar only)
37-
Text("Compatible with Toolbar")
36+
// MARK: Mini (Toolbar / List only)
37+
List {
38+
Section(header: Text("Compatible with Toolbar / List")) {
39+
SwiftNEW(show: $showNew, align: $align, color: $color, size: .constant("mini"), labelColor: $labelColor, label: $label, labelImage: $labelImage, history: $history, data: $data, showDrop: $showDrop)
40+
}
41+
}
3842
}
3943

4044
var invisible: some View {

Demo/What's New?/en.lproj/data.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
11
[
2+
{
3+
"version": "4.0",
4+
"subVersion": "4.0.0",
5+
"new": [
6+
{
7+
"icon": "number",
8+
"title": "Better Compatible",
9+
"subtitle": "in Version & Build",
10+
"body": "You can use x.y.z or x.y now."
11+
},
12+
{
13+
"icon": "macpro.gen3.server",
14+
"title": "Serverless",
15+
"subtitle": "Design",
16+
"body": "Free and open source! ❤️‍🔥"
17+
},
18+
{
19+
"icon": "arrow.triangle.pull",
20+
"title": "Contribute",
21+
"subtitle": "Together",
22+
"body": "Pull requests and make it better for everyone! 🎉"
23+
}
24+
]
25+
},
226
{
327
"version": "3.9",
428
"new": [

Demo/What's New?/zh-Hant.lproj/data.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
11
[
2+
{
3+
"version": "4.0",
4+
"subVersion": "4.0.0",
5+
"new": [
6+
{
7+
"icon": "number",
8+
"title": "更好兼容性",
9+
"subtitle": "在版本和構建中",
10+
"body": "您現在可以使用 x.y.z 或 x.y。"
11+
},
12+
{
13+
"icon": "macpro.gen3.server",
14+
"title": "無服務器",
15+
"subtitle": "設計",
16+
"body": "免費開源! ❤️‍🔥"
17+
},
18+
{
19+
"icon": "arrow.triangle.pull",
20+
"title": "貢獻",
21+
"subtitle": "一起",
22+
"body": "提出請求,變得更好! 🎉"
23+
}
24+
]
25+
},
226
{
327
"version": "3.9",
428
"new": [

Sources/SwiftNEW/SwiftNEW.swift

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public struct SwiftNEW: View {
9292
else {
9393
ScrollView(showsIndicators: false) {
9494
ForEach(items, id: \.self) { item in
95-
if item.version == Bundle.version {
95+
if item.version == Bundle.version || item.subVersion == Bundle.version {
9696
ForEach(item.new, id: \.self) { new in
9797
HStack {
9898
ZStack {
@@ -277,7 +277,13 @@ public struct SwiftNEW: View {
277277

278278
// MARK: - Functions
279279
public func compareVersion() {
280-
if Double(Bundle.version)! > version || Double(Bundle.build)! > build {
280+
let currentVersion = Bundle.version.replacingOccurrences(of: ".", with: "")
281+
let currentBuild = Bundle.build.replacingOccurrences(of: ".", with: "")
282+
283+
let savedVersion = String(version).replacingOccurrences(of: ".", with: "")
284+
let savedBuild = String(build).replacingOccurrences(of: ".", with: "")
285+
286+
if Int(currentVersion)! != Int(savedVersion)! || Int(currentBuild)! != Int(savedBuild)! {
281287
withAnimation {
282288
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
283289
if showDrop {
@@ -288,8 +294,8 @@ public struct SwiftNEW: View {
288294
show = true
289295
}
290296
}
291-
version = Double(Bundle.version)!
292-
build = Double(Bundle.build)!
297+
version = Double(currentVersion)! / 10
298+
build = Double(currentBuild)! / 10
293299
}
294300
}
295301
}
@@ -339,6 +345,7 @@ public struct SwiftNEW: View {
339345
// MARK: - Model
340346
public struct Vmodel: Codable, Hashable {
341347
var version: String
348+
var subVersion: String?
342349
var new: [Model]
343350
}
344351
public struct Model: Codable, Hashable {

0 commit comments

Comments
 (0)