Auto read SMS OTP an fill on top field

Hi, guys I need to implement SMS OTP screen I done the screen and working fine but , the requirement is when the SMS is pinged Ito need to be pasted on OTP field Automatically. How ? can you give Any suggestion.

You’ll want to look at using the UIPasteboard

Also note privacy changes in iOS 16 about using it

You can also use this video from Kavsoft on how to fetch OTP automatically.

SwiftUI Fetching OTP Automatically - Login Page With Firebase - MVVM - Xcode 13 - SwiftUI Tutorials