swift3 - Detect a written date/event in a text in Swift 3 -


i'm making chat app , behave apple mail app; means recognizes written dates , underlines them. example: if write email contains: "would meet on friday @ 4pm?" should automatically recognize , underline "friday @ 4pm" , when tap on asks me make reminder event.

unfortunately, haven't found on googling can't provide sample code; still hope has experience that.

here code refer here:-

let input = "this date 2017-02-02" let detector = try? nsdatadetector(types: nstextcheckingresult.checkingtype.date.rawvalue) guard let matches = detector?.matches(in: input, options: [], range: nsrange(location: 0, length: input.utf16.count)) else {return} match in matches {     let date = (input nsstring).substring(with: match.range)     print(date) } 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -