iOS/macOS 27 introduces NSGestureRecognizerRepresentable, NSHostingMenu, and NSHostingSceneRepresentation, enabling tighter and more flexible integration between SwiftUI and existing AppKit/UIKit apps. Additionally, @Observable-backed automatic redraw is now enabled by default in AppKit and UIKit draw methods without Info.plist opt-in.
• New NSGestureRecognizerRepresentable protocol allows adding native NSGestureRecognizer subclasses to SwiftUI views via .gesture(), previously impossible without NSViewRepresentable.
• New NSHostingMenu subclass of NSMenu lets you define AppKit menu content in SwiftUI and insert it into an existing NSMenu hierarchy.
• New NSHostingSceneRepresentation wraps any SwiftUI Scene (e.g. MenuBarExtra, Settings) so it can be added and removed dynamically from an NSApplicationDelegate.
• @Observable automatic redraw in NSView/UIView draw, layout, and constraint methods is now enabled by default with 2026 SDK targets, no Info.plist key required.
• NSGestureRecognizerRepresentable lets you attach existing NSGestureRecognizer subclasses directly to SwiftUI views via the .gesture() modifier, bridging custom platform gestures into SwiftUI without a full UIViewRepresentable wrapper.
• NSHostingMenu and NSHostingSceneRepresentation allow incremental SwiftUI adoption in AppKit apps — add SwiftUI-powered menu items and MenuBarExtra scenes directly from an NSApplicationDelegate without a full migration.
• @Observable-backed automatic redraw in NSView/UIView draw methods is now on by default in 2026 SDKs, eliminating manual needsDisplay bookkeeping across the entire AppKit and UIKit view lifecycle.
Demonstrates the new NSGestureRecognizerRepresentable protocol to attach a custom NSPressGestureRecognizer to a SwiftUI view, triggering an action on force click — bridging AppKit gesture recognizers directly into a SwiftUI view hierarchy.
import SwiftUI
import AppKit
import Observation
// MARK: - Observable Model
@Observable
final class ColorModel {
var hue: Double = 0.5
var saturation: Double = 0.8
var brightness: Double = 0.7
var color: Color {
Color(hue: hue, saturation: saturation, brightness: brightness)
}
func resetToFull() {
saturation = 1.0
brightness = 1.0
}
}
// MARK: - NSGestureRecognizerRepresentable conformance (new in macOS 26)
struct ForceClickReset: NSGestureRecognizerRepresentable {
var model: ColorModel
func makeNSGestureRecognizer(context: Context) -> NSPressGestureRecognizer {
let recognizer = NSPressGestureRecognizer()
// Stage 2 pressure = force click on supported trackpads
recognizer.pressureStage = .two
return recognizer
}
func handleNSGestureRecognizerAction(
_ recognizer: NSPressGestureRecognizer,
context: Context
) {
guard recognizer.state == .began else { return }
withAnimation(.spring(duration: 0.3)) {
model.resetToFull()
}
}
}
// MARK: - SwiftUI Color Swatch View
struct ColorSwatchView: View {
@State private var model = ColorModel()
var body: some View {
VStack(spacing: 20) {
RoundedRectangle(cornerRadius: 20)
.fill(model.color)
.frame(width: 200, height: 200)
.shadow(radius: 8)
// Attach the AppKit gesture recognizer via .gesture()
.gesture(ForceClickReset(model: model))
.overlay(
Text("Force Click\nto Reset")
.font(.caption)
.multilineTextAlignment(.center)
.foregroundStyle(.white.opacity(0.8))
)
VStack(alignment: .leading) {
Text("Hue").font(.caption)
Slider(value: $model.hue, in: 0...1)
Text("Saturation").font(.caption)
Slider(value: $model.saturation, in: 0...1)
Text("Brightness").font(.caption)
Slider(value: $model.brightness, in: 0...1)
}
.padding(.horizontal)
}
.padding()
.frame(width: 300)
}
}
#Preview {
ColorSwatchView()
}NSGestureRecognizerRepresentable, NSHostingMenu, and NSHostingSceneRepresentation are new macOS-only APIs. The automatic @Observable redraw in draw methods requires using the 2026 SDK or later (or opting in via Info.plist on older SDKs). NSHostingSceneRepresentation must be added during applicationWillFinishLaunching, not later in the app lifecycle.
None — works on all supported devices. Back-deployment available to macOS 15 / iOS 18 via Info.plist keys (NSObservationTrackingEnabled / UIObservationTrackingEnabled).
More iOS 27 APIs land every week.
Get notified when new capabilities are published — no noise, just signal.