Skip to content

Commit 7da050b

Browse files
committed
Update All Platform
1 parent b2365d6 commit 7da050b

File tree

6 files changed

+115
-53
lines changed

6 files changed

+115
-53
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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 = 8;
307+
CURRENT_PROJECT_VERSION = 9;
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 = 4.1;
321+
MARKETING_VERSION = 4.2;
322322
PRODUCT_BUNDLE_IDENTIFIER = io.startway.WhatsNew;
323323
PRODUCT_NAME = "$(TARGET_NAME)";
324324
SDKROOT = auto;
@@ -339,7 +339,7 @@
339339
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
340340
CODE_SIGN_ENTITLEMENTS = "What's New?/What_s_New_.entitlements";
341341
CODE_SIGN_STYLE = Automatic;
342-
CURRENT_PROJECT_VERSION = 8;
342+
CURRENT_PROJECT_VERSION = 9;
343343
DEVELOPMENT_ASSET_PATHS = "\"What's New?/Preview Content\"";
344344
DEVELOPMENT_TEAM = "";
345345
ENABLE_HARDENED_RUNTIME = YES;
@@ -353,7 +353,7 @@
353353
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
354354
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
355355
MACOSX_DEPLOYMENT_TARGET = 11.0;
356-
MARKETING_VERSION = 4.1;
356+
MARKETING_VERSION = 4.2;
357357
PRODUCT_BUNDLE_IDENTIFIER = io.startway.WhatsNew;
358358
PRODUCT_NAME = "$(TARGET_NAME)";
359359
SDKROOT = auto;

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

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Demo/What's New?/ContentView.swift

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct ContentView: View {
1717
@State var align: HorizontalAlignment = .center
1818
@State var color: Color = .accentColor
1919
@State var size: String = "normal"
20-
#if os(iOS)
20+
#if os(iOS) || os(xrOS)
2121
@State var labelColor: Color = Color(UIColor.systemBackground)
2222
#elseif os(macOS)
2323
@State var labelColor: Color = Color(NSColor.windowBackgroundColor)
@@ -56,45 +56,53 @@ struct ContentView: View {
5656
}
5757

5858
var body: some View {
59+
#if os(iOS)
5960
NavigationView {
60-
// MARK: Choose either one size (Normal, Mini or Invisible)
61-
TabView(selection: $preview) {
62-
normal
63-
.tabItem {
64-
Label("Normal", systemImage: "textformat.size.larger")
65-
}
66-
.tag("Normal")
67-
mini
68-
.tabItem {
69-
Label("Mini", systemImage: "textformat.size.smaller")
70-
}
71-
.tag("Mini")
72-
invisible
73-
.tabItem {
74-
Label("Invisible", systemImage: "questionmark.square.dashed")
75-
}
76-
.tag("Invisible")
77-
remote
78-
.tabItem {
79-
Label("Remote", systemImage: "cloud")
80-
}
81-
.tag("Remote")
82-
drop
83-
.tabItem {
84-
Label("Remote", systemImage: "capsule")
85-
}
86-
.tag("Drop")
87-
}
88-
.toolbar {
89-
if preview == "Mini" {
90-
SwiftNEW(show: $showNew, align: $align, color: $color, size: .constant("mini"), labelColor: $labelColor, label: $label, labelImage: $labelImage, history: $history, data: $data, showDrop: $showDrop)
91-
}
92-
}
61+
tab
9362
}
94-
#if os(iOS)
9563
.navigationViewStyle(.stack)
64+
#elseif os(macOS) || os(xrOS)
65+
tab.padding()
9666
#endif
9767
}
68+
69+
var tab: some View {
70+
// MARK: Choose either one size (Normal, Mini or Invisible)
71+
TabView(selection: $preview) {
72+
normal
73+
.tabItem {
74+
Label("Normal", systemImage: "textformat.size.larger")
75+
}
76+
.tag("Normal")
77+
mini
78+
.tabItem {
79+
Label("Mini", systemImage: "textformat.size.smaller")
80+
}
81+
.tag("Mini")
82+
invisible
83+
.tabItem {
84+
Label("Invisible", systemImage: "questionmark.square.dashed")
85+
}
86+
.tag("Invisible")
87+
remote
88+
.tabItem {
89+
Label("Remote", systemImage: "cloud")
90+
}
91+
.tag("Remote")
92+
#if os(iOS)
93+
drop
94+
.tabItem {
95+
Label("Remote", systemImage: "capsule")
96+
}
97+
.tag("Drop")
98+
#endif
99+
}
100+
.toolbar {
101+
if preview == "Mini" {
102+
SwiftNEW(show: $showNew, align: $align, color: $color, size: .constant("mini"), labelColor: $labelColor, label: $label, labelImage: $labelImage, history: $history, data: $data, showDrop: $showDrop)
103+
}
104+
}
105+
}
98106
}
99107

100108
struct ContentView_Previews: PreviewProvider {

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.2",
4+
"subVersion": "4.2.0",
5+
"new": [
6+
{
7+
"icon": "hammer",
8+
"title": "Minor",
9+
"subtitle": "Update",
10+
"body": "Minor bug fixes, and UI improvement."
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": "4.1",
428
"subVersion": "4.1.0",

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ let package = Package(
2121
],
2222
dependencies: [
2323
.package(name: "SwiftVB", url: "https://github.com/1998code/SwiftVBKit.git", .upToNextMinor(from: "1.4.0")),
24-
// .package(name: "Drops", url: "https://github.com/1998code/Drops.git", .upToNextMinor(from: "2.1.0"))
24+
.package(name: "Drops", url: "https://github.com/omaralbeik/Drops.git", .upToNextMinor(from: "1.7.0"))
2525
],
2626
targets: [
2727
.target(
2828
name: "SwiftNEW",
2929
dependencies: [
3030
"SwiftVB",
31-
// "Drops"
31+
"Drops"
3232
]
3333
)
3434
]

Sources/SwiftNEW/SwiftNEW.swift

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import SwiftUI
66
import SwiftVB
77

8-
//#if os(iOS)
9-
//import Drops
10-
//#endif
8+
#if os(iOS)
9+
import Drops
10+
#endif
1111

1212
@available(iOS 14, watchOS 7.0, macOS 11.0, *)
1313
public struct SwiftNEW: View {
@@ -66,6 +66,7 @@ public struct SwiftNEW: View {
6666
#endif
6767
}
6868
}
69+
.opacity(size == "invisible" ? 0 : 100)
6970
.sheet(isPresented: $show) {
7071
sheetCurrent
7172
.sheet(isPresented: $historySheet) {
@@ -83,6 +84,7 @@ public struct SwiftNEW: View {
8384
Spacer()
8485

8586
headings
87+
.padding(.bottom)
8688

8789
Spacer()
8890

@@ -117,7 +119,7 @@ public struct SwiftNEW: View {
117119
}
118120
}
119121
}.frame(width: 300)
120-
.frame(maxHeight: 450)
122+
.frame(maxHeight: 450)
121123
}
122124

123125
Spacer()
@@ -171,7 +173,7 @@ public struct SwiftNEW: View {
171173
}
172174
}
173175
}
174-
#elseif os(macOS)
176+
#elseif os(macOS) || os(xrOS)
175177
public var headings: some View {
176178
VStack {
177179
Text("What's New in").bold().font(.largeTitle)
@@ -182,9 +184,20 @@ public struct SwiftNEW: View {
182184
public var showHistoryButton: some View {
183185
Button(action: { historySheet = true }) {
184186
HStack {
187+
if align == .trailing {
188+
Spacer()
189+
}
185190
Text("Show History")
186191
Image(systemName: "arrow.up.bin")
192+
if align == .leading {
193+
Spacer()
194+
}
187195
}.font(.body)
196+
#if os(iOS)
197+
.frame(width: 300, height: 50)
198+
#elseif os(macOS)
199+
.frame(width: 200, height: 25)
200+
#endif
188201
}
189202
#if !os(xrOS)
190203
.foregroundColor(color)
@@ -202,7 +215,11 @@ public struct SwiftNEW: View {
202215
Spacer()
203216
}
204217
}.font(.body)
218+
#if os(iOS)
205219
.frame(width: 300, height: 50)
220+
#elseif os(macOS)
221+
.frame(width: 200, height: 25)
222+
#endif
206223
#if os(iOS) && !os(xrOS)
207224
.foregroundColor(.white)
208225
.background(color)
@@ -272,7 +289,11 @@ public struct SwiftNEW: View {
272289
Spacer()
273290
}
274291
}.font(.body)
292+
#if os(iOS)
275293
.frame(width: 300, height: 50)
294+
#elseif os(macOS)
295+
.frame(width: 300, height: 25)
296+
#endif
276297
#if os(iOS)
277298
.foregroundColor(.white)
278299
.background(color)
@@ -337,13 +358,13 @@ public struct SwiftNEW: View {
337358

338359
#if os(iOS)
339360
public func drop() {
340-
// let drop = Drop(title: "Tap", subtitle: "To See What's New.", icon: UIImage(systemName: labelImage),
341-
// action: .init {
342-
// Drops.hideCurrent()
343-
// show = true
344-
// },
345-
// position: .top, duration: 3.0, accessibility: "Alert: Tap to see what's new." )
346-
// Drops.show(drop)
361+
let drop = Drop(title: "Tap", subtitle: "To See What's New.", icon: UIImage(systemName: labelImage),
362+
action: .init {
363+
Drops.hideCurrent()
364+
show = true
365+
},
366+
position: .top, duration: 3.0, accessibility: "Alert: Tap to see what's new." )
367+
Drops.show(drop)
347368
}
348369
#endif
349370
}

0 commit comments

Comments
 (0)