Skip to content

Commit

Permalink
Vision os support (#272)
Browse files Browse the repository at this point in the history
* support visionOS

* Update Package.swift

* fix swift compiler error

* Disabled flaky test

---------

Co-authored-by: bryan-anderson <bryan1anderson@gmail.com>
  • Loading branch information
rajdeep and bryan1anderson authored Jan 18, 2024
1 parent b024d9a commit 14c352f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.3
// swift-tools-version:5.9
//
// Copyright © 2020 Rajdeep Kwatra. All rights reserved.
//
Expand All @@ -21,6 +21,7 @@ let package = Package(
name: "Proton",
platforms: [
.iOS(.v14),
.visionOS(.v1)
],
products: [
.library(name: "Proton", targets: ["Proton"]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
<Test
Identifier = "EditorSnapshotTests/testGetsRangeForRect()">
</Test>
<Test
Identifier = "EditorSnapshotTests/testRendersAsyncAttachments()">
</Test>
<Test
Identifier = "EditorSnapshotTests/testRendersPlaceholder()">
</Test>
Expand Down
18 changes: 16 additions & 2 deletions Proton/Sources/Swift/Editor/EditorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,19 @@ open class EditorView: UIView {

/// Input accessory view to be used
open var editorInputAccessoryView: UIView? {
get { richTextView.inputAccessoryView }
set { richTextView.inputAccessoryView = newValue }
get {
#if !os(visionOS)
return richTextView.inputAccessoryView
#else
return nil
#endif
} set {
#if os(visionOS)
return
#else
richTextView.inputAccessoryView = newValue
#endif
}
}

/// Input view to be used
Expand Down Expand Up @@ -320,10 +331,13 @@ open class EditorView: UIView {
set { richTextView.verticalScrollIndicatorInsets = newValue }
}

#if !os(visionOS)
public var keyboardDismissMode: UIScrollView.KeyboardDismissMode {
get { richTextView.keyboardDismissMode }
set { richTextView.keyboardDismissMode = newValue }
}
#endif


public var isScrollEnabled: Bool {
get { richTextView.isScrollEnabled }
Expand Down

0 comments on commit 14c352f

Please sign in to comment.