Questions tagged [swift4.1]

Use this tag only for questions directly related to changes in version 4.1 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.

Swift 4.1 contains updates to the core language, including more support for generics, new build options, as well as minor enhancements to Swift Package Manager and Foundation. There was also significant progress made in stabilizing the ABI.

Swift 4 is the fourth version of the Swift language developed by Apple that was released in 2017. The language is open source and available on Github (see ).

The development of Swift 4 and its goals can be viewed on the Swift Programming Language Evolution repository on GitHub

229 questions
3
votes
1 answer

Long Press Gesture called multiple times

I am getting an issue with UILongPressGestureRecognizer, I have used this code:- func addLongPressGesture(){ let lngPr = UILongPressGestureRecognizer.init(target: self, action: #selector(self.handleLongPress(gesture:))) …
user7433826
3
votes
3 answers

How do I paginate using swift and firebase?

I am working on an iOS app which has features similar to Instagram. I have successfully done pagination on my profile page but constantly failing to get the right result in my home feed. Goal - to fetch the posts in chronological order by date.…
Api42
  • 41
  • 8
3
votes
1 answer

Attributed text with TextView causing a crash

I have following swift code for generating an attributed string, func getAttributedTermsAndServicesText() -> NSAttributedString { let text = StringConstants.RegisterConstants.termsOfUseLabelText let attributedString =…
Pramod More
  • 1,220
  • 2
  • 22
  • 51
3
votes
1 answer

Struct is fileprivate and cannot be referenced from a default argument value in swift 4.1

Im using a struct with default values like this. fileprivate struct Defaults { static var BackgroundColor = UIColor.white static var TextColor = UIColor.black static var Title = "Default Title" static var Message = "Default…
3
votes
1 answer

NSRegularExpression.replacementString doesn't track changes in string length

I'm trying to write some code where I iterate over regex matches in a string and run an operation on the match, replacing it with the result of the operation. I'm running into problems though, where inside my replacementString() override the…
mpounsett
  • 1,174
  • 1
  • 10
  • 30
3
votes
2 answers

Decodable and JSON, 2 datatypes for same variable

I'm using the Decodable protocol to decode some json, but I've run into a problem: I'm getting an answer back, where a longitude and a latitide can be either an interger (latitude = 0) if there's no geo location data added to the element, and a…
Nicolai Harbo
  • 1,064
  • 12
  • 25
3
votes
0 answers

XCODE 9.3 Command failed due to signal: Abort trap: 6

After updating to Xcode 9.3 I am not able to compile my project. Where as compiling the same code on earlier version of xcode it works. After lot of investigation i found that there are few functions like in below error - 1. Running pass 'Function…
the monk
  • 389
  • 4
  • 14
3
votes
1 answer

Casting problems after updating from Swift 4 to 4.1

I've bumped into an odd issue, after updating to Swift 4.1 the cast from JSON to [[Float]] fails. Let me show the code real quick. Alamofire.request(url, method: .get, parameters: nil, headers: headers()).responseJSON(queue: queue,…
Recusiwe
  • 1,594
  • 4
  • 31
  • 54
3
votes
1 answer

Xcode 9.2 is not showing Swift 4.1

Apple compatibility documentation is mentioning that: Swift 4.1, the default version of Swift that’s included in Xcode 9.2. Yet, using Xcode Version 9.2 (9C40b), the choice of Swift Language Version that I have are 3.2 and 4.0: Is it a mistake in…
Cœur
  • 37,241
  • 25
  • 195
  • 267
2
votes
1 answer

Loading images from asset catalog from private pod

I have created a private pod which has some images, i have put that images in asset catalog, now when i try to access it, it does not load in my host app where i have installed this private pod This is my private podspec s.resource_bundles = { …
Fahadsk
  • 1,099
  • 10
  • 24
2
votes
5 answers

Position Navigation Bar top of the safe area

I upgraded to a new iphone and upgrade my apps. I added in the x/xr/xs layout so the black borders are gone now. I have a navigation bar at the top of my views but now it rides up into the status bar too much? How do I fix this? Doing it…
cdub
  • 24,555
  • 57
  • 174
  • 303
2
votes
2 answers

iOS Facebook URL schemes doesn't open page in facebook app

I need to open facebook page in facebook app. This is my code let url : URL! if (UIApplication.shared.canOpenURL(URL(string:"fb://")!)) { //FIXME: Url is not working ✋ let pageName = "google" // tried with fb://page?name=%@ not…
VishalPethani
  • 854
  • 1
  • 9
  • 17
2
votes
1 answer

Application crashing in iOS 12.0

Application crashing in iOS 12.0 before iOS 12.0 it was working properly, I have googled it but did not get any solution for below crash log. Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]:…
Nilesh
  • 533
  • 7
  • 19
2
votes
0 answers

dyld: Library not loaded: @rpath/SocketIO.framework/SocketIO

I've implemented swift4 custom framework with using of socketIO, added socket.io-client-swift through carthage. in build phase added run script build phase after generating of custom framework file , added into project embedded Binaries.…
2
votes
0 answers

RLMSupport.swift compile error under Swift 4.0 and Xcode 9.4

I want to Use Realm-objective-c with RLMSupport.swift under swift 4.1, But this code fragment: for model in banners { // do some stuff } banners is a RLMArray of instances of BannerModel, which defined in Objective-C. The definition like…
振华蒋
  • 21
  • 1
1 2
3
15 16