String(stringInterpolationSegment: issue in your sample swift project

hi, I have a question about your below linked sample project.

as it worked before for swift 4.2 , but today after I update my xcode to latest xcode ,swift 5 ,this line not working anymore.

in refreshMessageCenterBadge()

about this line 

String(stringInterpolationSegment:UAirship.inbox().messageList.unreadCount)  ,it show Extranuous argument label 'stringInterpolationSegment:" in call this error message.

 

so can you help what is correct writing for this line now?

 

 

 

 

https://github.com/urbanairship/ios-library/blob/master/SwiftSample/SwiftSample/AppDelegate.swift

 

 

@objc func refreshMessageCenterBadge() {
  DispatchQueue.main.async {
  if self.window?.rootViewController is UITabBarController {
  let messageCenterTab: UITabBarItem = (self.window!.rootViewController! as! UITabBarController).tabBar.items![self.MessageCenterTab]
   
  if (UAirship.inbox().messageList.unreadCount > 0) {
  messageCenterTab.badgeValue = String(stringInterpolationSegment:UAirship.inbox().messageList.unreadCount)
  } else {
  messageCenterTab.badgeValue = nil
  }
  }
  }
  }

Didn't find what you were looking for?

New post

Comments

1 comment

Please sign in to leave a comment.