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
answers80
views -
1
votes1
answer200
viewsViewpager on iOS with Swift 3
Hello, I’m developing an iPhone app using Swift 3, and I’m having some doubts regarding browsing between pages within a ViewController. My application to android I have a Activity using a ViewPager…
-
1
votes1
answer233
viewsError when converting string to date, with dateformatter in Swift
In user registration I have an input with a mask in this format "dd/MM/YY", after taking the value of the input, which comes as a string, I have to convert it to date. The conversion always worked,…
-
1
votes2
answers123
viewsSearchbar shows right result, leads to wrong Viewcontroller
I’m putting together an app that shows managers on Page1 and their respective employees on Page2. I decided to mount a plist and press a Tableview, see: To load the plist correctly insert to…
-
1
votes1
answer67
viewsDifficulty loading sections in cellForRowAt
I’m having a little difficulty in implementing indexes (A through Z) in my app... See the structure below, what should I do to properly load the indexPath.section?: struct EmployeeDetails { let…
-
1
votes3
answers138
viewsHow to treat a reponse.result.value that returns as log optional([])?
I am in the following situation I have a request in the Alamofire that returns me a json that may or may not have data (usually has but may not). I want to treat when Response.result.value returns…
-
1
votes1
answer63
viewsWhat’s the difference if I leave a variable in Otocol marked with Static or without Static in Swift 4?
I’m learning about protocols now, and I saw a code snippet in Swift 4 that defines a protocol, follows below the code snippet. protocol AnotherProtocol { static var someTypeProperty: Int { get set }…
-
1
votes3
answers160
viewsHow to put more than one pickerView in just one Viewcontroller
I’m trying to build a View that takes user data such as height, weight and age using Pickerviews. It is not returning any errors, but when I run, the Windows pickers only have a question mark,…
-
1
votes2
answers84
viewsNative iOS development
I have a question regarding the languages available for native development. I heard on a podcast that there are still applications that maintenance is done in objective-c. Would it be good to learn…
-
1
votes4
answers364
viewsSwift 3 - How to persist objects
I’m an Android developer and I’m trying to learn some things for iOS as well. I have hit myself a little on simple things, like saving persist an object of mine to catch it again another time. On…
-
1
votes1
answer171
viewsiOS - Changing the height of a Text Field inside Uistackview
I have a layout I’ve assembled using StackView. So I have a StackView vertical with some TextField, and two StackView horizontal inside. I now want to change the height of the textfields, thing the…
-
1
votes1
answer216
viewsDoubt Encoding Utf8 Swift 3
I’m having a lot of problems with encoding my app. I have an online radio in the United States and I’m trying an app for it. I get the music from Lastfm. let queryURL: String if useLastFM { queryURL…
-
1
votes1
answer212
viewsNotification with sound on Swift
I’m having a problem making an app similar to an alarm. What happens is that I can’t find any way for the user to select a song in their library and use it when playing a notification. This is…
-
1
votes1
answer554
viewsChange buton label by clicking and picking the entered value
Good afternoon, I have a button in my application that the value will be changed as the button is selected, must open a field for the user to type and consequently it takes the entered value and…
-
1
votes1
answer138
viewsHow do I get my app to login to a Swift 4 webview website?
import UIKit import WebKit class ViewController: UIViewController, WKUIDelegate { var webView: WKWebView! override func loadView() { let webConfiguration = WKWebViewConfiguration() webView =…
-
1
votes3
answers108
viewsValue of type 'String? ' has no Member 'Int'
I have the following problem: Value of type 'String? ' has on Member 'Int' What is the reason for the error and what is the solution? class ViewController: UIViewController { @IBOutlet var…
-
1
votes2
answers69
viewsWhat is the difference between these two statements?
Let’s say I created a struct point that gives a certain point in a "map". struct Ponto { let x: Int let y: Int init(x: Int, y: Int) { self.x = x self.y = y } What would be the difference between…
-
1
votes1
answer442
viewsHow to work with Alamofire Sponse on Swift 4?
I have the following request that returns me a json I cannot catch the live ulrs Alamofire.request(urlRequest).validate().responseJSON { response in print(response.data) do { if let data =…
-
1
votes1
answer42
viewsHow to show a View depending on a condition in Swiftui
In my project with swiftui I would like to present a view depending on the login status of my users. var body: some View { HStack() { HomeView() LoginView() } } HomeView should appear if the user is…
-
1
votes1
answer21
viewsActivity indicator in Swiftui
How do I display an activity indicator using Swiftui? I have a vague idea how to do this by introducing the UIActivityIndicatorView of UIKit using the function .overlay(overlay: ) but I wonder if…
-
1
votes3
answers424
viewsSort a string array in Swift using a function
I am in need of a help to solve the following programming logic problem on Swift. The task is to arrange the array below downwards using a function. Description: You must implement an algorithm that…
-
1
votes0
answers97
viewsModal navigation
In my IOS application I have an option that opens a modal, in this modal I have a list of items, when clicking one of these items I show the details of the selected item. The solution adopted today…
-
1
votes1
answer350
viewsHow do I call a function in Swift Xcode
Good evening, I have a function that is attached to a button, I would like to call it directly without the need of the button, what I do? The function... static func goToTutorialOrTo(market: Market,…
-
1
votes1
answer164
viewsOpen new screen Swift 4
I have a webview app, after the lauchScreen it goes to the Viewcontroller where it loads the page, I have a class that checks if there is a connection, and if there is not I would like to open a new…
-
1
votes2
answers79
viewsAction after back background application
I have a webview on android that always checks if there is internet when returning from the background checking if the connection status has been changed if it is offline the app sends the user to a…
-
1
votes1
answer60
viewsRemoving the Dictionary object on condition - Firebase - Swift
In my App I need to list information registered by the user, there is an "enable" field where "on" will not be displayed in the tableViewController, if "yes" will list, code below for help. First…
-
1
votes2
answers46
viewsReload Data in Uitableview using Firebase
I’m using a custom table that retrieves data from Firebase. But it only updates, new data, if I close the app and open again, even if entering the reloadData() on the table. Example: The table is…
-
1
votes2
answers170
viewsHow to open Waze and navigate by address
Good night, you guys How do I open Waze in the app and set the address via string (I want to navigate directly by address, not by coordinates) Right now, I’m doing it this way: func…
-
1
votes0
answers36
viewsNsregularexpression replacingOccurrences with multiple templates
I’m having difficulties to replace different templates in a text, my Regex returns more than one need to replace according to the variable value strReplaced Follows code: import Foundation let texto…
-
1
votes1
answer59
viewsParse json with struct, error passing to array - Swift 4.0
I have an error with Swift 4.0 in parse Json, I am using struct Decodable to receive json, I am new in Swift I work with objective-c. struct dataInativa: Decodable { let dia_data:String }…
-
1
votes1
answer298
views -
1
votes0
answers56
viewsError passing data to tableViewController
Oops! Guys, I have a problem, I’m making an app that consumes a themoviedb api and saves the movies in the Realm. On the main screen I’m using the Collectionviewcontroller, and when touching the…
-
0
votes2
answers832
viewsExample of Picker View in Swift
Dear friends, how to popular an Uipickerview object with the simple array? example: var titulos = ["texto1", "texto2", "texto3", "texto4"] how to set this array to a Uipickerview?…
-
0
votes1
answer88
viewsHow to define my Primary Key?
I am developing an application in Swift and started using the Core Data recently. I need to define which attribute of my entity will be mine Primary key. For example: I have an entity that has class…
-
0
votes2
answers300
viewsRead file . xlsm (Excel) from my application
How I read a file .xlsm (excel spreadsheet) from my application? Basically I need to get the data from this spreadsheet. Get the value of each of the cells that this has. Is there anything native…
-
0
votes1
answer100
viewsUitableview - Data from Disappearing Table
I own a UITableView simple. It is loaded from a .nib and added as a subview, it appears, loads the data, presents the same everything correctly, but from the moment I select a cell, the data simply…
-
0
votes1
answer58
viewsUiimage Temporaria
I need to download an image, it is displayed, but after displaying it I need to delete it from the device. But always when I open the app again it is already loaded. func getPhoto(pathPhoto: String,…
-
0
votes0
answers117
viewsiOS 8 - Manually changing Core Location permissions
I am developing an app for iOS 8 and require permission to CLLocationManager, but if the user does not accept the permission and tries to change in the privacy settings, the settings close at the…
-
0
votes1
answer190
viewsWebview with some problems in Swift
I got a problem Simple code: let url = "http://apple.com" override func viewDidLoad() { super.viewDidLoad() let requestURL = NSURL(string:url) let request = NSURLRequest(URL: requestURL!)…
-
0
votes1
answer349
viewsiPhone 5 and iOS 8 - Location permissions
On all devices is OK, the request for permission to use the location appears (independent iOS 7 or iOS 8). Only iPhone 5 does not appear. Code for requesting permission: var versionString =…
-
0
votes1
answer77
viewsError while using Sttwitter and Swifter
I am trying to use one of the two libraries Sttwitter or Swifter in my project but always error. In the case of Sttwitter the error is in the method call getUserTimelineWithScreenName:(NSString…
-
0
votes1
answer87
viewsOpen Terminal with Swift
Can I ask my graphics program to open a terminal window by passing some commands with parameters? I’m using Swift for OS X, Grateful.
-
0
votes1
answer204
viewsXml parser in Swift
I downloaded a ready project of rss Reader, it comes title description and image. However I am trying to edit the same for my xml. see the codes: // // FeedTableViewController.swift // RSSReader //…
-
0
votes1
answer36
viewsError inserting Slider inside View - Swift
I have a problem related to Swift Slider when I try to put it inside a View My project has the following structure View (main) View (used for grouping) Scrollview View () If I put the Slider inside…
-
0
votes1
answer86
viewsCore Data issue in iOS 7
I have a problem between iOS 8 and iOS 7. I am using Core Data, I have an entity called Pessoa (NSManagedObject), only when doing a data update happens a EXC_BAD_ACCESS, only that, no other…
-
0
votes1
answer63
viewsCustom Like Boot
Does anyone know if it is possible to customize the like button of facebook SDK? I need to use my image as the bottom of the button or make it a button. var likeControl:FBSDKLikeControl =…
-
0
votes2
answers69
viewsviewDidAppear equivalent on apple watch
I need to present a short animation (a sequence of images) when my App starts. The method willActivate does not help me as it is still not showing anything. There is some notification or something…
-
0
votes0
answers41
views -
0
votes1
answer193
viewsUsing the camera
I am implementing a screen that I would like to show the image of the camera, but I would just like to show the image, not with features of switching to front camera, cancel, and capture. Is there…
-
0
votes1
answer403
viewsFatal error: unexpectedly found nil while unwrapping an Optional value
I got the following error message: Fatal error: unexpectedly found nil while unwrapping an Optional value In the following code snippet: // Lê uma coluna do tipo String no (BANCO DE DADOS) func…