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
2 answers

Double in an object converts to a string when added in another object

Double in an object converts to a string (or just goes into quotation marks) when added in another object. I don't want this behavior. I want the double to remain as double so that my database rules work perfectly var list: [String: AnyObject] =…
Moaz Khan
  • 1,272
  • 1
  • 13
  • 28
0
votes
1 answer

Received json data is in form of 531 bytes and giving curruptedData error in swift 4.1 and Xcode 9.2

I am trying to get response from server which is in form of JSON with Swift 4.1 and Xcode 9.2. But the received JSON data by JSONDecoder is printing 531 bytes and giving error dataCorrupted(Swift.DecodingError.Context(codingPath: [],…
Neck
  • 611
  • 1
  • 7
  • 21
0
votes
1 answer

Parse arbitrary JSON in Swift 4.1

I want to parse JSON with Swift 4.1 I know this might look similar at first glance. Now, Swift 4.1 and Codable gives us a great tool. However how do I use it / parse it - when I don't know the structure??? Lets say my JSON can be { "foo" : "bar"…
bnassler
  • 591
  • 6
  • 15
0
votes
0 answers

how to fix boundaries to show limited google map area in Swift 4 (iOS)

I am able to set limited area to show at google map for user. After setting below code google map is not moving outside of this area defined with below code in Android: - final LatLngBounds ADELAIDE = new LatLngBounds( new LatLng(25.27,…
Asif Raza
  • 836
  • 12
  • 29
0
votes
1 answer

Swift 4.1: array in dictionary not updated

This strange behavior baffles me. I intend to create a dictionary with a single array field. Then within this array, two extra sub dictionaries are appended. Here is code, var dictionary = [String: Any]() var array = [[String: Any]]() …
jgtww
  • 33
  • 3
0
votes
1 answer

Unable to Modify View Elements when Adding a SubView

Background: I have 4 .XIB files which are initialized programmatically as Subviews to be called to the screen via the method self.view.addSubview(UIView). //Initialize Associate Degree Selection UIView and prepare contraints …
0
votes
2 answers

Pass a class type for use inside a method

In order to reduce cut-and-paste code in this app, I'm trying to pass class names around in order to tell a method which way it should process some data. I have something like the following: class MyClass : NSObject { var name : String =…
mpounsett
  • 1,174
  • 1
  • 10
  • 30
0
votes
0 answers

Corner radius delay

I'm currently setting the corner radius of a UIView via the storyboards user defined run time attributes window. When I start the application there is a 2-3 second delay before I see the corner radius getting applied. This is a new project, so…
WBuck
  • 5,162
  • 2
  • 25
  • 36
0
votes
0 answers

Adding subview self causing crash in swift 4.1

I have a custom view whose init method is as below. This used to work fine in Xcode 9.1 with swift 4. Today I updated to Xcode 9.3 and set the project base to swift 4.1 and it started crashing in this init method. init(frame: CGRect, detailDic:…
sonu
  • 41
  • 5
0
votes
1 answer

how to change textcolor in textfield when I add a row in tableview

I have two buttons.one is @addIncomeTapped and the other one is @addExpenseTapped.what I want to do is to change the textcolor in my textfield once the user tapped (for example) the addIncomeTapped button. I'm trying to figure it out but have no…
user9606399
0
votes
2 answers

Swift 4.1 - Set extension requires Element to conform to Encodable

protocol CodableWithDefault: Codable { static var `default`: Self { get } } extension Set: CodableWithDefault { static var `default`: Set { return Set() } } This was working fine in Swift 4, but since 4.1 it…
plu
  • 1,321
  • 10
  • 14
0
votes
0 answers

Error Domain=NSCocoaErrorDomain Code=3840 in Swift 4.1 (Xcode 9.3)

I was creating the iOS app with MYSQL. In app I used below code. import UIKit class ViewController: UIViewController { //URL to our web service let URL_SAVE_TEAM = URL(string:"http://my_url/ios_api/api/createteam.php") override func viewDidLoad()…
Kawazoe Kazuke
  • 175
  • 6
  • 20
0
votes
0 answers

Swift Codeable Not working

I have created a model to map my Api response to the swift struct with Codable protocol. but it always return nil. Note: - if i remove the isSelected from the model it works perfect. But I need this key to manage the selection from user. Also if i…
Ajay Singh Mehra
  • 1,313
  • 9
  • 19
0
votes
0 answers

Save metadata in swift4

I have searched many pages trying to find the code to save the metadata that is captured with an image using UIViewController, using Swift4.1 Is there a sample code that I can use for reference?
0
votes
0 answers

deprecated substring from swift 4

import Foundation class DateHandler { private static let stringOffset : Int = 10 static var todaysDate: String { return formatDateString(date: Date()) } static var tomorrowDate: String { guard let tommorrowDate =…