Skip to content

Commit 480caaf

Browse files
chore: replace Preview macro with old style
This is due to Xcode 15.0-generated xcframework treats the macro as an error.
1 parent 3bf8925 commit 480caaf

File tree

7 files changed

+179
-192
lines changed

7 files changed

+179
-192
lines changed

OSInAppBrowserLib.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,9 @@
629629
MARKETING_VERSION = 1.0.0;
630630
PRODUCT_BUNDLE_IDENTIFIER = com.outsystems.rd.inappbrowser.OSInAppBrowserLibTests;
631631
PRODUCT_NAME = "$(TARGET_NAME)";
632+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
633+
SUPPORTS_MACCATALYST = NO;
634+
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
632635
SWIFT_EMIT_LOC_STRINGS = NO;
633636
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
634637
SWIFT_VERSION = 5.0;
@@ -648,6 +651,9 @@
648651
MARKETING_VERSION = 1.0.0;
649652
PRODUCT_BUNDLE_IDENTIFIER = com.outsystems.rd.inappbrowser.OSInAppBrowserLibTests;
650653
PRODUCT_NAME = "$(TARGET_NAME)";
654+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
655+
SUPPORTS_MACCATALYST = NO;
656+
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
651657
SWIFT_EMIT_LOC_STRINGS = NO;
652658
SWIFT_VERSION = 5.0;
653659
TARGETED_DEVICE_FAMILY = "1,2";

OSInAppBrowserLib.zip

-41.9 KB
Binary file not shown.

OSInAppBrowserLib/WebView/Views/OSIABErrorView.swift

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@ struct OSIABErrorView: View {
4646
}
4747
}
4848

49-
#Preview("Default - Error Light") {
50-
OSIABErrorView(
51-
NSError(domain: "Preview", code: NSURLErrorBadURL),
52-
reload: { print("Clicked reload") },
53-
reloadViewLayoutDirection: .fixed(value: .leftToRight)
54-
)
49+
struct OSIABErrorView_Previews: PreviewProvider {
50+
static var previews: some View {
51+
OSIABErrorView(
52+
NSError(domain: "Preview", code: NSURLErrorBadURL),
53+
reload: { print("Clicked reload") },
54+
reloadViewLayoutDirection: .fixed(value: .leftToRight)
55+
)
56+
}
5557
}

OSInAppBrowserLib/WebView/Views/OSIABNavigationView.swift

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -151,27 +151,25 @@ private struct OSIABTestNavigationView: View {
151151
}
152152
}
153153

154-
#Preview("Default - Light Mode") {
155-
OSIABTestNavigationView()
156-
}
154+
struct OSIABNavigationView_Previews: PreviewProvider {
155+
static var previews: some View {
156+
// Default - Light Mode
157+
OSIABTestNavigationView()
157158

158-
#Preview("Default - Dark Mode") {
159-
OSIABTestNavigationView()
160-
.preferredColorScheme(.dark)
161-
}
159+
// Default - Dark Mode
160+
OSIABTestNavigationView()
161+
.preferredColorScheme(.dark)
162162

163-
#Preview("Show Navigation Buttons Disabled") {
164-
OSIABTestNavigationView(showNavigationButtons: false)
165-
}
163+
// Show Navigation Buttons Disabled
164+
OSIABTestNavigationView(showNavigationButtons: false)
166165

167-
#Preview("Back Button Enabled") {
168-
OSIABTestNavigationView(backButtonEnabled: true)
169-
}
166+
// Back Button Enabled
167+
OSIABTestNavigationView(backButtonEnabled: true)
170168

171-
#Preview("Forward Button Enabled") {
172-
OSIABTestNavigationView(forwardButtonEnabled: true)
173-
}
169+
// Forward Button Enabled
170+
OSIABTestNavigationView(forwardButtonEnabled: true)
174171

175-
#Preview("Both Buttons Enabled") {
176-
OSIABTestNavigationView(backButtonEnabled: true, forwardButtonEnabled: true)
172+
// Both Buttons Enabled
173+
OSIABTestNavigationView(backButtonEnabled: true, forwardButtonEnabled: true)
174+
}
177175
}

OSInAppBrowserLib/WebView/Views/OSIABWebView.swift

Lines changed: 109 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import SwiftUI
44
struct OSIABWebView: View {
55
/// View Model containing all the customisable elements.
66
@ObservedObject private var model: OSIABWebViewModel
7-
7+
88
/// Constructor method.
99
/// - Parameter model: View Model containing all the customisable elements.
1010
init(_ model: OSIABWebViewModel) {
1111
self.model = model
1212
}
13-
13+
1414
var body: some View {
1515
VStack {
1616
if let toolbarPosition = model.toolbarPosition {
@@ -28,7 +28,7 @@ struct OSIABWebView: View {
2828
)
2929
}
3030
Spacer()
31-
31+
3232
Button(action: model.closeButtonPressed, label: {
3333
Text(model.closeButtonText)
3434
.bold()
@@ -39,14 +39,14 @@ struct OSIABWebView: View {
3939
}
4040
if let error = model.error {
4141
OSIABErrorView(
42-
error,
42+
error,
4343
reload: model.loadURL,
4444
reloadViewLayoutDirection: .fixed(value: .leftToRight)
4545
)
4646
} else {
4747
OSIABWebViewRepresentable(model.webView)
4848
}
49-
49+
5050
if model.toolbarPosition == .bottom {
5151
OSIABNavigationView(
5252
showNavigationButtons: model.showNavigationButtons,
@@ -72,7 +72,7 @@ struct OSIABWebView: View {
7272
private extension OSIABWebViewModel {
7373
convenience init(
7474
url: String,
75-
showURL: Bool,
75+
showURL: Bool,
7676
showToolbar: Bool,
7777
toolbarPosition: OSIABToolbarPosition,
7878
showNavigationButtons: Bool,
@@ -112,7 +112,7 @@ private struct OSIABTestWebView: View {
112112
private let showNavigationButtons: Bool
113113
private let leftToRight: Bool
114114
private let isError: Bool
115-
115+
116116
init(
117117
closeButtonText: String = "Close",
118118
showURL: Bool = true,
@@ -130,7 +130,7 @@ private struct OSIABTestWebView: View {
130130
self.leftToRight = leftToRight
131131
self.isError = isError
132132
}
133-
133+
134134
var body: some View {
135135
VStack {
136136
OSIABWebView(
@@ -150,142 +150,128 @@ private struct OSIABTestWebView: View {
150150
}
151151
}
152152

153-
// MARK: - Default Views
153+
struct OSIABWebView_Previews: PreviewProvider {
154+
static var previews: some View {
155+
// MARK: - Default Views
154156

155-
#Preview("Default - Light Mode") {
156-
OSIABTestWebView()
157-
}
157+
// Default - Light Mode
158+
OSIABTestWebView()
158159

159-
#Preview("Default - Dark Mode") {
160-
OSIABTestWebView()
161-
.preferredColorScheme(.dark)
162-
}
160+
// Default - Dark Mode
161+
OSIABTestWebView()
162+
.preferredColorScheme(.dark)
163163

164-
#Preview("Error - Light Mode") {
165-
OSIABTestWebView(isError: true)
166-
}
164+
// Error - Light Mode
165+
OSIABTestWebView(
166+
isError: true
167+
)
167168

168-
// MARK: - Custom Close Button View
169+
// MARK: - Custom Close Button View
169170

170-
#Preview("Custom Close Button Text") {
171-
OSIABTestWebView(
172-
closeButtonText: "Done"
173-
)
174-
}
171+
// Custom Close Button Text
172+
OSIABTestWebView(
173+
closeButtonText: "Done"
174+
)
175175

176-
// MARK: - No Toolbar View
176+
// MARK: - No Toolbar View
177177

178-
#Preview("No Toolbar") {
179-
OSIABTestWebView(
180-
showToolbar: false
181-
)
182-
}
178+
// No Toolbar
179+
OSIABTestWebView(
180+
showToolbar: false
181+
)
183182

184-
// MARK: - Custom Views
183+
// MARK: - Custom Views
185184

186-
#Preview("No URL and No Navigation Buttons") {
187-
OSIABTestWebView(
188-
showURL: false,
189-
showNavigationButtons: false
190-
)
191-
}
185+
// No URL and No Navigation Buttons
186+
OSIABTestWebView(
187+
showURL: false,
188+
showNavigationButtons: false
189+
)
192190

193-
#Preview("No URL, No Navigation Buttons and Left-to-Right") {
194-
OSIABTestWebView(
195-
showURL: false,
196-
showNavigationButtons: false,
197-
leftToRight: true
198-
)
199-
}
191+
// No URL, No Navigation Buttons and Left-to-Right
192+
OSIABTestWebView(
193+
showURL: false,
194+
showNavigationButtons: false,
195+
leftToRight: true
196+
)
200197

201-
#Preview("No URL") {
202-
OSIABTestWebView(
203-
showURL: false
204-
)
205-
}
198+
// No URL
199+
OSIABTestWebView(
200+
showURL: false
201+
)
206202

207-
#Preview("No URL and Left-To-Right") {
208-
OSIABTestWebView(
209-
showURL: false,
210-
leftToRight: true
211-
)
212-
}
203+
// No URL and Left-To-Right
204+
OSIABTestWebView(
205+
showURL: false,
206+
leftToRight: true
207+
)
213208

214-
#Preview("No URL, Bottom Toolbar and No Navigation Buttons") {
215-
OSIABTestWebView(
216-
showURL: false,
217-
toolbarPosition: .bottom,
218-
showNavigationButtons: false
219-
)
220-
}
209+
// No URL, Bottom Toolbar and No Navigation Buttons
210+
OSIABTestWebView(
211+
showURL: false,
212+
toolbarPosition: .bottom,
213+
showNavigationButtons: false
214+
)
221215

222-
#Preview("No URL, Bottom Toolbar, No Navigation Buttons and Left-to-Right") {
223-
OSIABTestWebView(
224-
showURL: false,
225-
toolbarPosition: .bottom,
226-
showNavigationButtons: false,
227-
leftToRight: true
228-
)
229-
}
216+
// No URL, Bottom Toolbar, No Navigation Buttons and Left-to-Right
217+
OSIABTestWebView(
218+
showURL: false,
219+
toolbarPosition: .bottom,
220+
showNavigationButtons: false,
221+
leftToRight: true
222+
)
230223

231-
#Preview("No URL and Bottom Toolbar") {
232-
OSIABTestWebView(
233-
showURL: false,
234-
toolbarPosition: .bottom
235-
)
236-
}
224+
// No URL and Bottom Toolbar
225+
OSIABTestWebView(
226+
showURL: false,
227+
toolbarPosition: .bottom
228+
)
237229

238-
#Preview("No URL, Bottom Toolbar and Left-to-Right") {
239-
OSIABTestWebView(
240-
showURL: false,
241-
toolbarPosition: .bottom,
242-
leftToRight: true
243-
)
244-
}
230+
// No URL, Bottom Toolbar and Left-to-Right
231+
OSIABTestWebView(
232+
showURL: false,
233+
toolbarPosition: .bottom,
234+
leftToRight: true
235+
)
245236

246-
#Preview("No Navigation Buttons") {
247-
OSIABTestWebView(
248-
showNavigationButtons: false
249-
)
250-
}
237+
// No Navigation Buttons
238+
OSIABTestWebView(
239+
showNavigationButtons: false
240+
)
251241

252-
#Preview("No Navigation Buttons and Left-to-Right") {
253-
OSIABTestWebView(
254-
showNavigationButtons: false,
255-
leftToRight: true
256-
)
257-
}
242+
// No Navigation Buttons and Left-to-Right
243+
OSIABTestWebView(
244+
showNavigationButtons: false,
245+
leftToRight: true
246+
)
258247

259-
#Preview("Left-to-Right") {
260-
OSIABTestWebView(
261-
leftToRight: true
262-
)
263-
}
248+
// Left-to-Right
249+
OSIABTestWebView(
250+
leftToRight: true
251+
)
264252

265-
#Preview("Bottom Toolbar and No Navigation Buttons") {
266-
OSIABTestWebView(
267-
toolbarPosition: .bottom,
268-
showNavigationButtons: false
269-
)
270-
}
253+
// Bottom Toolbar and No Navigation Buttons
254+
OSIABTestWebView(
255+
toolbarPosition: .bottom,
256+
showNavigationButtons: false
257+
)
271258

272-
#Preview("Bottom Toolbar, No Navigation Buttons and Left-to-Right") {
273-
OSIABTestWebView(
274-
toolbarPosition: .bottom,
275-
showNavigationButtons: false,
276-
leftToRight: true
277-
)
278-
}
259+
// Bottom Toolbar, No Navigation Buttons and Left-to-Right
260+
OSIABTestWebView(
261+
toolbarPosition: .bottom,
262+
showNavigationButtons: false,
263+
leftToRight: true
264+
)
279265

280-
#Preview("Bottom Toolbar") {
281-
OSIABTestWebView(
282-
toolbarPosition: .bottom
283-
)
284-
}
266+
// Bottom Toolbar
267+
OSIABTestWebView(
268+
toolbarPosition: .bottom
269+
)
285270

286-
#Preview("Bottom Toolbar and Left-to-Right") {
287-
OSIABTestWebView(
288-
toolbarPosition: .bottom,
289-
leftToRight: true
290-
)
271+
// Bottom Toolbar and Left-to-Right
272+
OSIABTestWebView(
273+
toolbarPosition: .bottom,
274+
leftToRight: true
275+
)
276+
}
291277
}

0 commit comments

Comments
 (0)