I'm seeing it in XCode 16 beta as well.
Post
Replies
Boosts
Views
Activity
This response is incorrect. Currently there isn't a way to publish an tvOS app to the App Store or even archive the app without owning an Apple TV. You can however build and test your application on the simulator without owning an Apple TV.
Interestingly enough, this isn't a requirement with visionOS as of now (and hopefully, fingers crossed it won't be added).
Submitted as FB13686829
Unfortunately I don't have a real device to confirm and won't have the funds to get one anytime soon, but your asking did make me recheck and I found some interesting behavior.
Working on iOS Real Device iPad, iPhone (Uses port 6970)
Working on macOS Real Device (Uses port 6970)
Not working on iOS Simulator (Uses random port)
Not working on VisionOS Simulator (Uses random port)
I thought I had already checked and it worked on iOS simulator, but I guess I mis-remembered. I'll consider this closed for now until I get a VisionOS bug report saying that it's an issue there on real devices.
Fixed here:
import AppKit
struct CaptureVerticalScrollWheelModifier: ViewModifier {
func body(content: Content) -> some View {
content
.background(ScrollWheelHandlerView())
}
struct ScrollWheelHandlerView: NSViewRepresentable {
func makeNSView(context: Context) -> NSView {
let view = ScrollWheelReceivingView()
return view
}
func updateNSView(_ nsView: NSView, context: Context) {}
}
class ScrollWheelReceivingView: NSView {
private var scrollVelocity: CGFloat = 0
private var decelerationTimer: Timer?
override var acceptsFirstResponder: Bool { true }
override func viewDidMoveToWindow() {
super.viewDidMoveToWindow()
window?.makeFirstResponder(self)
}
override func scrollWheel(with event: NSEvent) {
var scrollDist = event.deltaX
var scrollDelta = event.scrollingDeltaX
if abs(scrollDist) < abs(event.deltaY) {
scrollDist = event.deltaY
scrollDelta = event.scrollingDeltaY
}
if event.phase == .began || event.phase == .changed || event.phase.rawValue == 0 {
// Directly handle scrolling
handleScroll(with: scrollDist, precise: event.hasPreciseScrollingDeltas)
scrollVelocity = scrollDelta
} else if event.phase == .ended {
// Begin decelerating
decelerationTimer = Timer.scheduledTimer(withTimeInterval: 0.016, repeats: true) { [weak self] timer in
guard let self = self else { timer.invalidate(); return }
self.decelerateScroll()
}
} else if event.momentumPhase == .ended {
// Invalidate the timer if momentum scrolling has ended
decelerationTimer?.invalidate()
decelerationTimer = nil
}
}
private func handleScroll(with delta: CGFloat, precise: Bool) {
var scrollDist = delta
if !precise {
scrollDist *= 2
}
guard let scrollView = self.enclosingScrollView else { return }
let contentView = scrollView.contentView
let contentSize = contentView.documentRect.size
let scrollViewSize = scrollView.bounds.size
let currentPoint = contentView.bounds.origin
var newX = currentPoint.x - scrollDist
// Calculate the maximum allowable X position (right edge of content)
let maxX = contentSize.width - scrollViewSize.width
// Ensure newX does not exceed the bounds
newX = max(newX, 0) // No less than 0 (left edge)
newX = min(newX, maxX) // No more than maxX (right edge)
// Scroll to the new X position if it's within the bounds
scrollView.contentView.scroll(to: NSPoint(x: newX, y: currentPoint.y))
scrollView.reflectScrolledClipView(scrollView.contentView)
}
private func decelerateScroll() {
if abs(scrollVelocity) < 0.8 {
decelerationTimer?.invalidate()
decelerationTimer = nil
return
}
handleScroll(with: scrollVelocity, precise: true)
scrollVelocity *= 0.95
}
}
}
extension View {
func captureVerticalScrollWheel() -> some View {
self.modifier(CaptureVerticalScrollWheelModifier())
}
}
The fix is actually much simpler (at least for me running watchOS 10). If you embed your sheet view in a navigation stack like this, there will be a little circular "X" button at the top left of your sheet.
MyMainView()
.sheet {
NavigationStack {
MySheetView()
}
}
As it turns out, the default cancel button is embedded in the toolbar, and the toolbar doesn't show up at all unless your view is embedded in a navigation stack
I also ran into this issue. My problem was that I was using an offset on inputNode.lastRenderTime. To resolve it, I needed to convert it using inputNode.playerTime(forNodeTime: inputNode.lastRenderTime) before I schedule with scheduleBuffer(buffer, at: futureTime)
See here https://developer.apple.com/documentation/avfaudio/avaudioplayernode/1390449-playertime
For posterity, I implemented similar code to the above on macOS Sonoma 14.0 (23A344) and got the same address already in use error :/
Is there any way I can check the status of this bug? Has this been resolved in iOS 17?