Questions tagged [swift4.2]

Use this tag only for questions directly related to changes in version 4.2 of Apple's Swift programming language. Use the tag [swift] for more general language questions, or the tags [ios], [cocoa], [apple-watch] etc. for questions about developing on Apple platforms.

666 questions
64
votes
1 answer

Could not load IOSurface for time string. Rendering locally instead swift 4

Could you help me with this problem when I running my project : Could not load IOSurface for time string. Rendering locally instead I don't know what is going on with my codding ..... pleas help .
Mr Ice
  • 690
  • 1
  • 6
  • 9
45
votes
1 answer

DispatchQueue : Cannot be called with asCopy = NO on non-main thread

I am presenting the UIAlertController on the main thread as : class HelperMethodClass: NSObject { class func showAlertMessage(message:String, viewController: UIViewController) { let alertMessage = UIAlertController(title: "", message:…
Amit
  • 4,837
  • 5
  • 31
  • 46
34
votes
4 answers

UIEdgeInsetsInsetRect' has been replaced by instance method 'CGRect.inset(by:)

I made the mistake up updating my project to Swift 4.2 without waiting for pods to be updated. I have slowly updated all of my code, but there's one line that I can't seem to figure out. var animationRect = UIEdgeInsetsInsetRect(frame,…
Dustin Johnson
  • 405
  • 1
  • 4
  • 5
29
votes
6 answers

Type 'NSNotification.Name' has no member 'keyboardDidShowNotification'

I'm getting this error with Swift 4.2 Type 'NSNotification.Name' has no member 'keyboardDidShowNotification' Here is my code: NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardDidShow(notification:)), name:…
Krunal
  • 77,632
  • 48
  • 245
  • 261
28
votes
6 answers

Swift 4.2+ seeding a random number generator

I'm trying to generate seeded random numbers with Swift 4.2+, with the Int.random() function, however there is no given implementation that allows for the random number generator to be seeded. As far as I can tell, the only way to do this is to…
RPatel99
  • 7,448
  • 2
  • 37
  • 45
25
votes
7 answers

Upload files with parameters from multipartformdata using alamofire 5 in ios swift

I am trying upload files with parameters (multipartformdata) but i can't do it with new version Alamofire 5, if you have some experience with Alamofire 5 please share it with me. func uploadPluckImage(imgData : Data, imageColumnName : String, …
Diaa SAlAm
  • 366
  • 1
  • 4
  • 7
22
votes
4 answers

Expected to decode Int but found a number instead

I had issue with JSON parsing in Swift 4.2. Here is the following code which shown runtime error. My Json data is as follow which i got from server. { code: 406, message: "Email Address already Exist.", status: 0 } I am using Codable…
Jatin Chauhan
  • 1,107
  • 1
  • 8
  • 21
20
votes
3 answers

Type 'NSNotification.Name' has no member 'UITextField'

With Swift 4.2, getting following error, that was working fine with Swift 4. Type 'NSNotification.Name' has no member 'UITextField' Here is my error code. NotificationCenter.default.addObserver(forName:…
Krunal
  • 77,632
  • 48
  • 245
  • 261
17
votes
2 answers

Invalid redeclaration of 'variable.storage' in Swift 4.2 after updating to Xcode 10.2

We have an iOS project. The Swift language version is 4.2. We were previously building it in Xcode 10.1 with no compile errors. After updating to Xcode 10.2 (but keeping Swift 4.2), the project is now riddled with errors like Invalid redeclaration…
Phlippie Bosman
  • 5,378
  • 3
  • 26
  • 29
17
votes
4 answers

AVAudioSession setCategory availability in Swift 4.2

After migrating to Swift 4.2, I am getting multiple errors, one of which is weird. It seems like a bug in Xcode 10, but is there a workaround available? do { try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playAndRecord,…
Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131
17
votes
1 answer

Swift 4.2: [Swift._EmptyArrayStorage _getValue:forType:]: unrecognized selector

I'm facing a NSInvalidArgumentException exception after upgrading a project to Swift 4.2 (conversion from 4.0). 2018-09-19 15:37:33.253482+0100 -beta[3715:1010421] -[Swift._EmptyArrayStorage _getValue:forType:]: unrecognized selector sent…
ricardopereira
  • 11,118
  • 5
  • 63
  • 81
16
votes
2 answers

How to make an enum conform to Hashable with the API available in Xcode 10?

In my Swift 4.2.1 code I have this enumeration: enum MyEnum { case caseOne(Int) case caseTwo(String) case caseThree } It conforms to Equatable: extension MyEnum: Equatable { static func == (lhs: MyEnum, rhs: MyEnum) -> Bool { …
Roman Podymov
  • 4,168
  • 4
  • 30
  • 57
16
votes
3 answers

Swift Catch Pattern that binds the error to a variable

Using Swift 4.2 and XCode 10 In Swift 4.2, DecodingError is an enumeration. There are (currently) four different cases. I can catch each case separately, and bind variables that I can use to log the error as in the following code ... do { let…
escapedcanadian
  • 283
  • 5
  • 10
15
votes
5 answers

Xcode 10, LLDB: Couldn't IRGen expression

Using Xcode 10, when I stop my app using a breakpoint and try to print the content of an object in the Console, I obtain: "Couldn't IRGen expression, no additional error" However, I can see the value of the object in the Variables View panel. How…
asclepix
  • 7,971
  • 3
  • 31
  • 41
14
votes
5 answers

Xcode 10 convert to Swift 4.2 fails

I am getting this error trying to migrate to Swift 4.2 using the Xcode provided conversion tool. How do I fix it? The code builds fine otherwise.
Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131
1
2 3
44 45