Skip to content

Commit

Permalink
Updated Workarounds.
Browse files Browse the repository at this point in the history
  • Loading branch information
SDGGiesbrecht authored Sep 3, 2022
1 parent 6dc97b0 commit 214e941
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ for target in package.targets {
var swiftSettings = target.swiftSettings ?? []
defer { target.swiftSettings = swiftSettings }
swiftSettings.append(contentsOf: [
// #workaround(Swift 5.6, Web lacks Foundation.ProcessInfo.)
// #workaround(Swift 5.6, Web lacks Foundation.RunLoop.)
// #workaround(Swift 5.6.1, Web lacks Foundation.ProcessInfo.)
// #workaround(Swift 5.6.1, Web lacks Foundation.RunLoop.)
// @example(conditions)
.define("PLATFORM_HAS_COCOA_INTERFACE", .when(platforms: [.macOS, .tvOS, .iOS])),
.define(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@

internal func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {

// #workaround(Swift 5.6, @SceneBuilder does not support “if”, so Settings cannot be conditional.)
// #workaround(Swift 5.6.1, @SceneBuilder does not support “if”, so Settings cannot be conditional.)
if menuItem.action == #selector(NSApplicationDelegate.showPreferencesWindow(_:)),
application.preferences is EmptyView
{ // @exempt(from: tests) Only reachable from SwiftUI’s main().
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
See http://www.apache.org/licenses/LICENSE-2.0 for licence information.
*/

// #workaround(Swift 5.6, SwiftUI would be a step backward from AppKit or UIKit without the ability to get the selected text for menu items like “Show Character Information”.)
// #workaround(Swift 5.6.1, SwiftUI would be a step backward from AppKit or UIKit without the ability to get the selected text for menu items like “Show Character Information”.)
#if canImport(SwiftUI) && !canImport(AppKit) && !(canImport(UIKit) && !os(watchOS))
import SwiftUI

Expand Down
4 changes: 2 additions & 2 deletions Sources/SDGInterface/Text/Text Field/TextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

#if canImport(AppKit) || (canImport(UIKit) && !os(watchOS))
public func cocoa() -> CocoaView {
// #workaround(Swift 5.6, SwiftUI would be a step backward from AppKit or UIKit without the ability to get the selected text for menu items like “Show Character Information”.)
// #workaround(Swift 5.6.1, SwiftUI would be a step backward from AppKit or UIKit without the ability to get the selected text for menu items like “Show Character Information”.)
#if !canImport(AppKit) && !canImport(UIKit)
return useSwiftUIOrFallback(to: {
return CocoaView(
Expand All @@ -68,7 +68,7 @@
#endif
}

// #workaround(Swift 5.6, SwiftUI would be a step backward from AppKit or UIKit without the ability to get the selected text for menu items like “Show Character Information”.)
// #workaround(Swift 5.6.1, SwiftUI would be a step backward from AppKit or UIKit without the ability to get the selected text for menu items like “Show Character Information”.)
#if !canImport(AppKit) && !(canImport(UIKit) && !os(watchOS))
@available(macOS 10.15, tvOS 13, iOS 13, watchOS 6, *)
extension TextField: View {
Expand Down
6 changes: 3 additions & 3 deletions Tests/SDGInterfaceTests/APITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ final class APITests: ApplicationTestCase {
if #available(watchOS 6, *) {
#if os(watchOS)
class Legacy: LegacyView, SDGInterface.View {
// #workaround(Swift 5.6, The next #if is redundant, but for compiler bug.)
// #workaround(Swift 5.6.1, The next #if is redundant, but for compiler bug.)
#if !(os(Linux) || os(Android))
func swiftUI() -> some SwiftUI.View {
return EmptyView().swiftUI()
Expand Down Expand Up @@ -1586,7 +1586,7 @@ final class APITests: ApplicationTestCase {
if #available(macOS 10.15, tvOS 13, iOS 13, watchOS 6, *) {
#if canImport(SwiftUI)
let testBody: Bool
// #workaround(Swift 5.6, SwiftUI would be a step backward from AppKit or UIKit without the ability to get the selected text for menu items like “Show Character Information”.)
// #workaround(Swift 5.6.1, SwiftUI would be a step backward from AppKit or UIKit without the ability to get the selected text for menu items like “Show Character Information”.)
#if !canImport(AppKit) && !(canImport(UIKit) && !os(watchOS))
testBody = true
#else
Expand Down Expand Up @@ -1771,7 +1771,7 @@ final class APITests: ApplicationTestCase {
#if canImport(SwiftUI) && !(os(iOS) && arch(arm))
if #available(macOS 10.15, tvOS 13, iOS 13, watchOS 6, *) {
struct SomeView: SwiftUI.View {
// #workaround(Swift 5.6, The next #if is redundant, but for compiler bug.)
// #workaround(Swift 5.6.1, The next #if is redundant, but for compiler bug.)
#if !(os(Linux) || os(Android))
var body: some SwiftUI.View {
return SwiftUI.EmptyView()
Expand Down

0 comments on commit 214e941

Please sign in to comment.