No '|' candidates produce the expected contextual result type 'NSTextStorageEditActions'

前端 未结 2 792
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-03 20:07

I went through the Text Kit Tutorial on raywenderlich.com and the line

edited(.EditedCharacters | .EditedAttributes, range: range, changeInLength: (str as NS         


        
2条回答
  •  悲&欢浪女
    2021-01-03 20:14

    Put them all in an array like below:

    instead of pipe

    let timeDateComponents = calendar.components(NSCalendarUnit.Hour| NSCalendarUnit.Minute| NSCalendarUnit.Second, fromDate: NSDate())
    

    try this

    let timeDateComponents = calendar.components([NSCalendarUnit.Hour, NSCalendarUnit.Minute, NSCalendarUnit.Second], fromDate: NSDate())
    

提交回复
热议问题