'SwiftUI - Value of type 'Text' has no member 'localized

I'm following this tutorial on localization which is in UIKit and I'm trying to apply it to my SwiftUI app.

I'm getting this error Value of type Text has no member localized. Not sure how to call this function for Swiftui Text.

Text("Hello").localized()
   
extension String {
   func localized() -> String {
       return NSLocalizedString( self,tableName: "Localizable", bundle: .main, value: self, comment: self)
       
   }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source