swift2.3

UIAlertcontroller set attributed messages

*爱你&永不变心* 提交于 2019-12-01 15:22:41
How we can set Attributed text in UIAlertcontroller as message. My try code As bellow, but it will crash the app. // create Attributed text let myAttribute = [NSForegroundColorAttributeName: UIColor(red:122.0/255, green:125.0/255, blue:131.0/255, alpha:1.0),NSFontAttributeName: Constant.flinntRegularFont(15)] let myAttribute2 = [NSForegroundColorAttributeName: UIColor.blackColor(),NSFontAttributeName: Constant.flinntMediumFont(15)] let myString = NSMutableAttributedString(string: "You have been unsubscribed from ", attributes: myAttribute) let myString2 = NSMutableAttributedString(string: self

Module compiled with Swift 2.3 cannot be imported in Swift 3.0

扶醉桌前 提交于 2019-12-01 15:00:49
i add Facebook SDK (Swift) to my project. And now i update Xcode 8 and Swift 3. I have error in build time Module compiled with Swift 2.3 cannot be imported in Swift 3.0 It is very strange that is not supported. Has anyone had similar problems? Remember to set Use Legacy Swift Language Version to YES for your project target You are building your project in 2.3 and not in 3.0 Have in mind that if you want to use Swift 3 as your main project's language you have to use pods that are either Swift 3, or Swift 2.2-. If you try to use a Swift 2.3 project, they will not compile (as in the error you

Why do I get the error \"Argument type 'String' does not conform to expected type 'sequence'

旧街凉风 提交于 2019-12-01 13:14:48
I'm trying to convert user input from a textField to an array. I followed the code that was offered here https://stackoverflow.com/a/27501398 let someString : String = someTextField.text! let someArray = Array(someString).map { String($0).toInt()! } But then I get this error: Argument type "String" does not conform to expected type "Sequence" What am I doing wrong? It seems that as of Swift 2.0, String no longer conforms to SequenceType . You can work around this if you're really in love with functional programming. However, there's no need to get so fancy here: let text : String = "12345" var

Why do I get the error "Argument type 'String' does not conform to expected type 'sequence'

笑着哭i 提交于 2019-12-01 09:50:36
问题 I'm trying to convert user input from a textField to an array. I followed the code that was offered here https://stackoverflow.com/a/27501398 let someString : String = someTextField.text! let someArray = Array(someString).map { String($0).toInt()! } But then I get this error: Argument type "String" does not conform to expected type "Sequence" What am I doing wrong? 回答1: It seems that as of Swift 2.0, String no longer conforms to SequenceType . You can work around this if you're really in love

Swift2.3 code for Beacon detection

混江龙づ霸主 提交于 2019-11-29 00:45:19
We are in advanced stages of developing a Swift2.2 app and hence have decided to migrate to 2.3 in the interim and do the full Swift 3 migration later. However we are unable to get beacon detection working post conversion to Swift 2.3. The method "didRangeBeacons" keeps returning an empty array. The same code was working in Swift 2.2 so we know we have all the permissions etc in place. Also if we open the "Locate" app on the same ipad then our app also starts returning data in "didRangeBeacons". Have tried various versions of the apps out there and all Swift2.3 apps are behaving the same way.

cornerRadius stopped working in Swift 2.3 / iOS 10 / Xcode 8

旧时模样 提交于 2019-11-27 20:03:44
I have a cornerRadius set on a UIView and a UIImageView inside the same UIView . I am calculating the corner radius with RockProfileView.frame.size.height / 2 but the UIView stopped showing in iOS 10. After further checking i found the value of RockProfileView.frame.size.height / 2 is coming out to be 1000.0 while the width and height constraint is set to 64.0 When I hardcoded the RockProfileView.layer.cornerRadius = 32 to 64/2 it works just fine. What could be the issue ? Full code: RockProfileView.layer.cornerRadius = RockProfileView.frame.size.height / 2 RockProfileView.clipsToBounds = true

Unable to use indices.contains() in a Collection extension in Swift 3

廉价感情. 提交于 2019-11-27 15:07:47
I wrote following extension in Swift 2.3: extension CollectionType { /// Returns the element at the specified index iff it is within bounds, otherwise nil. subscript (safe index: Index) -> Generator.Element? { return indices.contains(index) ? self[index] : nil } } However, it turns out that Swift 3.0 does not have contains() function. Instead, it offers me following syntax for this method: indices.contains(where: { (<#Self.Indices.Iterator.Element#>) -> Bool in <# code ??? what should it do??? #> }) The problem is that I don't know what should it contain inside the block. Any help with

cornerRadius stopped working in Swift 2.3 / iOS 10 / Xcode 8

自闭症网瘾萝莉.ら 提交于 2019-11-26 22:56:09
问题 I have a cornerRadius set on a UIView and a UIImageView inside the same UIView . I am calculating the corner radius with RockProfileView.frame.size.height / 2 but the UIView stopped showing in iOS 10. After further checking i found the value of RockProfileView.frame.size.height / 2 is coming out to be 1000.0 while the width and height constraint is set to 64.0 When I hardcoded the RockProfileView.layer.cornerRadius = 32 to 64/2 it works just fine. What could be the issue ? Full code:

Unable to use indices.contains() in a Collection extension in Swift 3

≡放荡痞女 提交于 2019-11-26 17:01:57
问题 I wrote following extension in Swift 2.3: extension CollectionType { /// Returns the element at the specified index iff it is within bounds, otherwise nil. subscript (safe index: Index) -> Generator.Element? { return indices.contains(index) ? self[index] : nil } } However, it turns out that Swift 3.0 does not have contains() function. Instead, it offers me following syntax for this method: indices.contains(where: { (<#Self.Indices.Iterator.Element#>) -> Bool in <# code ??? what should it do??