Get IPAddress from iPhone or iPad using Swift 3

This question already has an answer here: Swift - Get device's IP Address 5 answers How to get the device IP Address without using any third party libraries using Swift 3 programming language. Actually I have used following code in order to get the I

Swift 3, iOS - UIImageView for background

I currently have several labels and buttons in a UIView. I am using Storyboards and I want to add an image to the background. I tried it this way: override func viewDidLoad() { super.viewDidLoad() self.view.backgroundColor = UIColor(patternImage: UII

Xcode console indicating that Firebase is not configured

I don't know why this isn't working my Firebase is configured. Here is a Screenshot of my AppDelegate.swift file. Here is my console log: 2017-05-29 17:52:53.141 Study M8[31592] <Error> [Firebase/Core][I-COR000003] The default Firebase app has not y

The presentation of the collection is null, I tried everything

I set up a very custom collection view and setup everything properly I keep getting this error 'UICollectionView must be initialized with a non-nil layout parameter'. here is my code. I have researched my code indepthly and made sure i had no problem

Swift 3 and the code converter to loop the rows inversely

I have this code which is not compatible with swift3 for var i = FCatalogIdx-1; i > -1; i -=1 { // access items in array FCaalogArr } Code converter suggest converting to for i in ((-1 + 1)...FCatalogIdx-1).reversed() { which seems to be the the same

Adding multiple textfields to firebase using swift

Image of my view controller: This is my code class AddViewController: UIViewController { @IBOutlet weak var questionField: UITextField! @IBOutlet weak var correctAnswer: UITextField! @IBOutlet weak var optionA: UITextField! @IBOutlet weak var optionB

Change the property of the button of the different class

I have a button on a view controller - that view is of class "MainView" contains another viewContainer, whose view is of class "SecondView". I have code in the secondView.swift file that calls a function in MainView.swift MainView().up

Zero JSON result after analysis

I am trying to extract the value from a JSON serialization but getting nil as the result. App was working under Swift2 so its the conversion to Swift 3 where the issue started. let jsonResult = try JSONSerialization.jsonObject(with: data!, options: .

Delete optional string for date in UIDatePicker

Happy New Year, all! How do I get a datePicker text to show like this Jan 1, 2017 instead of 2017/1/1? In my PlayGround, it looks as expected but in my simulator or console, it looks not expected. // createDatePicker(): datePicker.datePickerMode = .d

Delete a specific object from the table in swift 3

I have a problem trying to remove a specific object from an array in Swift 3. I want to remove item from an array as in the screenshot but I don't know the solution. If you have any solutions please share with can find the index of object in a

IOS fast how can I check empty array while getting Json data

I am very new to swift and in my code I get JSON from a certain email, the JSON data is first put into an Array in swift, however if the array is null or there is no Json Data I get this error Could not cast value of type 'NSNull' (0x1067a5748) to 'N

How can I add a right border to a UIView in Swift 3?

I have an UIView on the top of my screen and I want to add a right border of 1 pixel to it. Here is the code that I have by the moment: var border = CALayer() border.backgroundColor = UIColor(red: 241, green: 10, blue: 9, alpha: 1).cgColor border.fra

Retrieve linked tables in swift 3

I am trying to fetch all models that belong to a brand, but when I'm trying to get the foreign key I am getting an NSSET type with some kind of address structure that have foreign key inside of that, and I am stuck with that, here is my code: class f

Sort alphanumeric table Swift3

I have a function I was using in Xcode 8 Beta, which sorted an array alphabetically then numerically. The function I used was: func sortArray(arrayToSort: [String])->[String]{ let sortedArray = arrayToSort.sorted { (first, second) in

Distance from a point to the ellipse

I need to somehow compute the distance between a point and an Ellipse. I describe the Ellipse in my program as coordinates x = a cos phi and y = b sin phi (where a,b are constants and phi the changing angle). I want to compute the shortest distance b

Why Swift Printing & ldquo; Optional (455 bytes) & rdquo;

I am working on a weather app, and trying to get the data from an API. But when I type in a city name and hit enter, Swift prints out a message "Optional(455 bytes)" Not sure what goes wrong. import Foundation protocol WeatherServiceDelegate{ fu

New application of Swift 3 warning crashes

when i implement either proposed fix the app crashes when run. When i compile/run the app without the recommended fix the app runs as expected. the original method is as follows: func tableView(_ tableView: UITableView, cellForRowAtIndexPath indexPat

Add a delay to a for loop in swift

I have a coding 'issue'. I have a label, which text I want to change dynamically every 2 seconds. I've done the following: // WELCOME STRING ARRAY let welcomeContainer:[String] = ["Welcome","Benvenuti","Bienvenue","Willk

Break the text that covers other views

Is it possible to break the text automatically, so the text isn't covering it, like the example below, in UITextview? Add CoreText Framework import CoreText Add the below code after adding the imageView to UITextView, var exclusionPath = UIBezierPath

NSFastEnumerationIteration.member Swift 3

I have some difficult to convert my Swift 2.2 app to Swift 3.0. I have some errors and I don't find the solution yet. Currently, my worst problem is with NSFastEnumerationIteration, I try to get records from JSON but with this error I can't. This is

Use Xcode8 with a quick project 2.3 that uses cocoapods

I have a project with a light amount of code written in what I assume is swift 2.3 It contains and app extension also written in swift 2.3 and uses 2 Cocoapods: SwiftyJSON and MMWormhole. After downloading Xcode 8.3 beta, the migrator ran and I am le