Most voted "swift" questions
Swift is a multi-paradigm programming language for Apple’s iOS and macOS operating systems. It was created by Chris Lattner in 2010 and released on Apple’s WWDC on 06/02/2014. It is currently in version 5.
Learn more…491 questions
Sort by count of
-
1
votes2
answers79
viewsIs it possible to convert an array [Any] to Nsdata?
I need to generate an Nsdata variable from an array that allows any type of data. I tried the following tickle, which didn’t work: let a0 : Int8 = 3 let a1 : UInt16 = 231 let a2 : Int = 1024 let…
-
1
votes2
answers112
viewsHow to put video inside a view
I need to put a video inside a view, in this it has to run only inside that square not fullscreen. (like facebook) I’ve researched about and only seen full screen tutorials. How to do this? I got it…
-
1
votes1
answer240
viewsDoubt, add value of an array [Anyobject] using Swift?
How would I do it in Swift? var jogador02 = ["Teste", 0] jogador02[1] += 1 result be equal to jogador02 = ["teste", 1]
swiftasked 8 years, 10 months ago Bruno Bafilli 327 -
1
votes1
answer109
viewsWhat would be the possible solution to this problem with Facebookappid?
What could be the solution to this problem, since the app id is string.…
-
1
votes3
answers210
viewsHow to recover the first letter of a Swift array
I would like to know how to retrieve the first letter of an array element var wordEasy = ["uva", "manga"] var teste: String = wordEasy[0] I would like to retrieve only the letter u…
-
1
votes0
answers38
viewsIOS - How do app send notifications when closed?
I wonder how I can perform an action, such as a notification for example, with the app closed. Like when you’re not using your phone and get a message notification from Facebook or a game for ex. I…
-
1
votes1
answer92
viewsHow can I do in Xcode the java code mentioned in the question?
This class on Android when enabled, I can close the app that keeps it running and keep Cell’s screen lit this way Keep the screen on: PowerManager pm = (PowerManager)…
-
1
votes1
answer611
viewsHow to load an Image into a Uitableview?
I performed a request that returned me some texts and urls with images, these images I need to load them along with the text in parallel in the table. I am using Alamofire + Alamofireimage to load…
-
1
votes1
answer46
viewsCheck which Textfield is calling textFieldDidBeginEditing
I have several textFields on my screen and would like to know which one of them started an action. For example: func textFieldDidBeginEditing(textField: UITextField) { if textField // aqui eu não…
-
1
votes1
answer456
viewsHow to pass to Array JSON information on Swift
When the result comes from the server I use the following code snippet to receive the result: if let JSON = response.result.value { print("JSON: \(JSON)") } And the result of the print is: [{ Nome =…
-
1
votes1
answer77
viewsAlamofire 3 how to pick up errors if they exist in the call to the service(Swift2)
I have the following code to call the server Alamofire.request(mutableURLRequest) .responseJSON{ request, response, result in response in if let value: AnyObject = response.result.value { let post =…
-
1
votes1
answer234
viewsClass - pass by reference
Consider the following code Techo: class Circle { var radius: Double init(radius: Double) { print("I'm initializing a new Circle instance with a radius value of \(radius).") self.radius = radius }…
swiftasked 8 years, 8 months ago Geraldo Roberson 11 -
1
votes1
answer140
viewsHow to add text at specific position in String Array
Setting: I have a webservice that I use to pick up texts, these texts can be modified by a web interface, but the title of them will always be fixed, so it was decided to insert them directly into…
-
1
votes2
answers856
viewsSwift - How to automatically change Imageview image
I have some images and an Imageview according to the photos I would like to be able to switch the image of View, switching from one to the other every 5 seconds automatically. How could I do this?…
swiftasked 8 years, 7 months ago CristianCotrena 1,145 -
1
votes2
answers190
viewsUitableviewcontroller with Swift and JSON Displaying repeated values
I’m having a hard time getting popular with mine UITableView with JSON. I separated some images to show the problem. Note that in the first Table Repeated values appear and next shows the same…
-
1
votes2
answers96
viewsHow to debug errors in Realm DB?
How can I debug this error and know its origin: lib c++Abi.dylib: terminating with uncaught Exception of type Realm ::Incorrect threadexception: Realm accessed from incorrect thread.…
-
1
votes1
answer65
viewsHide Tabbar and Show Uitoolbar
In my project I have a Tableview within navigation controller (Tabbar > Navigation Controller > Tableview Controller) When I press the Edit Tabbar button is being hidden and showing the…
-
1
votes3
answers964
viewsHow to change the title of the "back" button of the navigation bar
I would like to change the title of the back button of the navigation bar, change from " I tried this way but I did not succeed self.navigationController?.navigationItem.backBarButtonItem?.title =…
-
1
votes1
answer34
viewsSwift - How to stop an animation?
In my initial Viewcontroler I have a slide that keeps loading from the internet and alternating on the screen images at a time stipulated by me. How can I stop the animation? I wanted to do this…
-
1
votes2
answers414
views -
1
votes1
answer51
viewsSwift - how to fix in Landscapeleft a screen?
The app has 4 screens and, only one should be fixed in Landscapeleft. The others are in Portrait.. On the tab General I set it up this way. General: In Objective-C I can force this way: Solution in…
-
1
votes1
answer90
viewsNsnotificationcenter calls several times the page - Swift
Here’s what I wanna do: 1st user is in the app and decides to quit. By pressing the home button of the iphone. 2nd user enters the app and instead of continuing on the page he was on when he left,…
-
1
votes1
answer105
viewsError in Facebook API Return
Follow my scenario for better understanding: I have View Home calling View Login, by pushViewController. In my Login View, there is the custom Facebook button that is normally calling the facebook…
-
1
votes2
answers80
viewshow to add white space between strings
Good, I have 2 fields: First and Last. in the output the 2 names come out pasted without space between them. this already thanks for the help.…
-
1
votes2
answers330
viewsJSON Array for Swift object 3
There is someone help me and guide me, I am studying iOS development so I put a library "Alamofire" with cocoapods to consume JSON so far so good, only my JSON returns like this: { "results":[ {…
-
1
votes1
answer1003
viewsHow to create combobox in Swift?
I want to create a combobox to list all courses that my app offers but I did not find the corresponding component, alias found a similar and implemented Pickerview, but I would like to reproduce the…
-
1
votes1
answer186
viewsHow to assemble a dictionary from two arrays, one from keys and the other from Swift values
I have two arrays containing information of courts and players. Need to put in a tableview this data, being that the sections of the table would be the blocks and the values, of each section, would…
-
1
votes1
answer690
viewsPost request on webservice with Swift
I’m starting now to use the still, I managed to make requests . get but stopped in post request. I created a user class that has name, email and password, however I can’t post a user object let…
-
1
votes1
answer105
viewsHow to encrypt and decrypt data in Swift 3 form native without using any external lib
I have a service in c# which must be accessed with a url encrypted. Is there any way to encrypt data on Swift natively without using these lib cocoapods? My project doesn’t use any of this and would…
-
1
votes1
answer51
viewsLoad webView after clicking allow on SWIFT 3
I have a webView that captures the device token using the firebase library and then sends it to my url via get. Until ai td right, I was able to get the token, and I can send it to the url and in…
-
1
votes1
answer238
viewsHow to pass a value from a dictionary (which is inside another dictionary) to a Label? Swift 3
I have a database something like this: { "status": "OK", "data": [ { "id": 1, "name": "Mike", "informations": [ { "id": 474, "text": "My son", "reference": "www.google.com", } ] } I’m looking for…
-
1
votes1
answer112
viewsUicollectionview in 2 columns
Fellas, I got a IUCollectionView that this presenting of the data in 3 columns, as I could do to show only 2 with a centralized image?…
-
1
votes2
answers208
viewsSwift 3 - How to resize Uitableview automatically
How to automatically resize a Uitableview according to the amount of content in it? I want to do something like what you can do with an Uitextview: MyTextView.sizeToFit()…
-
1
votes1
answer151
viewsHow to update a Uiwebview to include and remove a Uiactivityindicatorview
I am having difficulty including and finishing the display of a Uiactivityindicatorview ("loading animation"). I have tried using webViewDidStartLoad and webViewDidFinishLoad respectively to start…
-
1
votes1
answer53
viewsCreate custom map using corelocation
I wonder if there is a way to insert a map made by you and not google maps. I am trying to create an indoor application Location and I have to insert a plant instead of google maps. Anyone there…
-
1
votes1
answer711
viewsCommand to comment multiple lines in the Xcode?
Hello Is there a shortcut for commenting multiple lines in the Xcode? I mean, I use it today /*...*/, but I have to go to the beginning of the block to mark the beginning and do the same until the…
-
1
votes1
answer142
viewsModule Compiled with Swift 3.0.2 cannot be Imported in Swift 3.1
When creating a project and installing the cocoapods and the still, when running it only gives this error and not build in the project, even empty only importing the still Module Compiled with Swift…
-
1
votes1
answer74
viewsShare a pdf file in Swift by email
Good afternoon I have a Tab Bar Item and would like when I click on it to trigger a Uiactivityviewcontroller that would pay a PDF of an ex link:(http://www.meusite/boleto.pdf) and I can send it as…
-
1
votes4
answers744
viewsHow to validate if Textfield is empty?
Good night, my friends I am having difficulty in the following, I intend that the user receive a warning when the textfield is empty and if it pressed the button. tried with the if condition…
-
1
votes1
answer162
viewsHow to redirect to a Viewcontroller
for conflict issues between two frameworks, I had to pass the login code from facebook to a helper class, however I’m not sure how to redirect the user to the main screen of the app after the login…
-
1
votes1
answer116
viewsHow to adjust the height of a Uiview on Swift 3 according to subviews?
I have a Uiview with subviews, and I need Uiview to increase or decrease according to the size of the subviews, the same idea of a layout with wrap_content height. Does anyone know how to do this on…
-
1
votes1
answer189
views'The number of view controllers provided (2) doesn’t match the number required (1) for the requested Transition'
I’m using TabBarController and I get this mistake : The number of view controllers provided (2) doesn’t match the number required (1) for the requested Transition When I exit the home screen and…
-
1
votes1
answer399
viewsWhat is the importance of Weak and unowned in Swift?
I have been studying Swift for some time and now I want to delve into the language and the IOS platform. I wanted to know more concretely what is the importance and the correct way to use Weak and…
-
1
votes1
answer78
viewsList append on for loop - Swift 3 / Xcode 8
I’m having a problem Adding items to a list Inside the 'for' loop, Where all items in the list are repeated with the last value entered. Here is my Nsmanagedobject list var listCursosNovos: [Cursos]…
-
1
votes1
answer55
viewsHow to improve this method that compares three numbers?
Can help me improve this little code so it’s less extensive and clean? The code compares three numbers and shows which and the largest among them: @IBAction func comprar(_ sender: Any) { if…
-
1
votes3
answers330
viewsArray Pose in Swift
I would like to know how to find the position of an Array in SWIFT Does anyone know? var nomes = ["Douglas", "Marilia", "Roberto", "Carol", "Lucas", "Iasmim", "João", "Zeca"]…
-
1
votes1
answer158
viewsProblem when doing POST method on Swift
I’m with that body to make a POST to the backend '{"token":"xxxx", "extra_information": {"expires_in": xxxx, "refresh_token": "xxx", "user_id": "user_uuid", "token_type": "Bearer"}}' The parameters…
-
1
votes1
answer409
viewsSwift 3/JSON - How to capture List of objects inside an object?
How do I access a list of objects within another list of objects? I can capture these objects peacefully, but I’m having trouble capturing objects within this list. This is my JSON: In this case I…
-
1
votes1
answer151
viewsFile lost in Xcode
When I copy a Swift file and paste it from my folder, it does not appear in Xcode.…
-
1
votes2
answers75
viewsError Scanning Evreflection Bool
I have a class: class Ingrediente: EVNetworkingObject { var idIngrediente:NSNumber! var nomeIngrediente:String! var adicional:Bool! var valorAdicional:NSNumber! var empresa:NSNumber! } and this…
swiftasked 7 years, 8 months ago Bruno Nicoletti 81