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
0
votes
1 answer

Change Tab Bar Item Image inset by accessing Tab Bar Items in AppDelegate

I want to align the tab bar item images in my tab bar. I know I can do it in IB which I did and it worked. However I want to do it programatically. I'm trying to do it in AppDelegate. Following is my code which doesn't work. Can anyone point me…
Matt
  • 315
  • 2
  • 6
  • 20
0
votes
1 answer

How to remove Tab Bar top border (shadow) in > iOS 10 and Swift 4 with a background image?

I've been trying to remove the top border (shadow) line from Tab Bar in Swift 4 for > iOS 10. I'm also using a custom background image. I've just given up after searching for solutions, since none of them work. The solution which came closest was…
Matt
  • 315
  • 2
  • 6
  • 20
0
votes
1 answer

Binary operator '===' cannot be applied to operands of type 'Self.Element' and 'AnyObject'

I get the following error: Binary operator '===' cannot be applied to operands of type 'Self.Element' and 'AnyObject' on the line: return contains { $0 === object }. Is there a way to cast object to the type of Iterator.Element? Does the line where…
ajrlewis
  • 2,968
  • 3
  • 33
  • 67
0
votes
1 answer

Type 'NSAttributedStringKey' (aka 'NSString') has no member 'foregroundColor'

Below is line of code for the above mentioned issue. This issue is occurred in Swift 4.1. let textAttributes = [NSAttributedStringKey.foregroundColor:UIColor.white] navigationController?.navigationBar.titleTextAttributes = textAttributes
0
votes
4 answers

Unexpected "some()" in implicit unwrapping using nil coalescing in swift 4.1

I experienced a strange response from xcode 9.3 running swift 4.1 while running this code: let old = "not an int" let new: Int! = Int(old) ?? 2 print(new) print(new!) Response is some(2) and 2 (with forced unwrapping) (check image below). Where…
Nabeel Khan
  • 3,715
  • 2
  • 24
  • 37
0
votes
1 answer

UISwitch added to a tableView is selected when scrolling

I have embed a UISwitch on a UITableView cell. override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) if…
Maria Work
  • 43
  • 1
  • 4
0
votes
1 answer

How to send data from AppDelegate to my subclass of ViewController in swift 4

I am using Swift 4.1 and I am wondering how to pass the url data that is given here: func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool { } into my subclass of…
Adam
  • 2,070
  • 1
  • 14
  • 18
0
votes
0 answers

found nil while unwrapping an optional value(firebase)

I am using firebase frameworks to upload the X coordinates of a sprite to the server in real time and the other sprite will mirror its moves using the coordinates that get from the server but gives the error found nil while unwrapping an…
0
votes
1 answer

Swift-4: Can't move to another ViewController from a ViewController

I have designed a UITableviewCell using Xib. The cell has a button when the button clicked it should move to another viewController. I have written delegate method to trigger the function in viewController, in the function, I used PushViewController…
A.Yesuvin
  • 25
  • 6
0
votes
2 answers

Custom UINavigationBar status bar not included background image

I'm trying set background image for UINavigationBar but status bar always white color Result My code self.navigationController?.navigationBar.setBackgroundImage(UIImage(named:"bg_nav")?.resizableImage(withCapInsets: UIEdgeInsets.zero,…
a.masri
  • 2,439
  • 1
  • 14
  • 32
0
votes
1 answer

Menu bar icon gone

I'm absolutely new to Swift and trying to create simple menu bar app. When I add an icon to menu bar it's just flicking once and it's gone. func applicationDidFinishLaunching(_ aNotification: Notification) { // Insert code here to initialize…
chubbyk
  • 6,212
  • 13
  • 53
  • 67
0
votes
1 answer

Correct way to load data from database and load it to the view in Vapor 3?

I have a Vapor 3 project which can upload some content String with format in html. And have function to load this content as a html page. The code looks like: func newpost(_ reqest: Request) throws -> Future { self.getContent(req: reqest)…
lee
  • 7,955
  • 8
  • 44
  • 60
0
votes
0 answers

Display uploaded image using the new Firebase. swift 4

How can I download the image I uploaded in Firebase? Here is how I upload my images: func uploadProfileImage(_ image:UIImage, completion: @escaping ((_ url:URL?)->())) { guard let uid = Auth.auth().currentUser?.uid else { return } let…
user9606399
0
votes
0 answers

UIActivityViewController not Sharing both Text and Image on Facebook

I used the UIActivityViewController to sharing both Image and Text. In other apps like twitter, notes, email have all worked. In facebook it does not have text and have only image to share. Please help me how to share both Image and Text to work…
Kawazoe Kazuke
  • 175
  • 6
  • 20
0
votes
1 answer

Unexpected result of remainder operator % in a while loop - Swift

I'm trying to find factors of a set of doubles, so I'm converting them to Integers first and finding the divisor using %. Option 1 The problem I have is that when the conversion happens in my loop, I'm loosing some information, particularly, if call…
gbdavid
  • 1,639
  • 18
  • 40