Home > Mobile >  NavigationLink init(_:destination:) deprecated
NavigationLink init(_:destination:) deprecated

Time:12-19

NavigationLink's initializer

init<S>(_ title: S, destination: Destination) where S : StringProtocol

is deprecated and only available for iOS 13.0–15.2. The replacement is

init<S>(_ title: S, destination: () -> Destination) where S : StringProtocol

per the documentation: NavigationLink initializer error

What's wrong with my use of the recommended initializer?

EDIT 1: Xcode Version 12.5.1 (12E507)

CodePudding user response:

Updating from Xcode 12.5.1 (12E507) to 13.2.1 (13C100) fixed this.

The SwiftUI source in Xcode 12 did not contain the NavigationLink initializers with the destination parameter as a closure type; Xcode 13 did.

  • Related