Questions tagged [swift]

Swift is a general-purpose, open-source programming language developed by Apple Inc. for their platforms and Linux. Use the tag only for questions about language features, or requiring code in Swift. Use the tags [ios], [macos], [watch-os], [tvos], [cocoa-touch], and [cocoa] for (language-agnostic) questions about the platforms or frameworks.

0
votes
0answers
4 views

Understanding UIView Height When Constraints Are Set with AutoLayout/UIScrollView

I hope this helps, but I am trying to wrap my head around a concept. I have a UIScrollView, added to a self.view in my ViewController, with its top, leading, trailing, and bottom edges pinned to ...
0
votes
1answer
19 views

how can i add a call button to cells [duplicate]

I'm trying to develop my first app on IOS platform and i want to add a call button to different cells and give each cell a different number to call because I want to programmatically add number to ...
0
votes
1answer
14 views

How to navigate to another page when faceId identified?

when click button I added face id recognition and if true, need to navigate another page. But not working. application crashed. After few minutes navigate to the next page and back button not working. ...
0
votes
0answers
18 views

Core Data relationship does not persist

My application uses Core Data with two managed object contexts (moc). The first moc is assigned an object of entity CDPatient and the second is assigned an object of entity CLEntry. The relationship ...
-1
votes
1answer
20 views

Set Multiple TableView height swift

I use 3 tableview in my style. But the height of the height of this tableView do not change what I do. So the height is always the standard value. I can't raise the height. TableViews are working ...
0
votes
0answers
14 views

'<…> is not a valid NSFetchRequest.'

I am using a custom source expression NSExpression(format: "FETCH(FUNCTION($manager, \"customFetchRequestForSourceEntityNamed:predicateString:\" , \"\(mapping.sourceEntityName!)\", \"TRUEPREDICATE\"), ...
-1
votes
2answers
30 views

Binary operator '==' cannot be applied to operands of type '(Any) -> Int' and 'Int'

I would like that the index will be equal to 1 or 2 but I got the error * "Binary operator '==' cannot be applied to operands of type '(Any) -> Int' and 'Int'" so how can I resolve this please ? ...
0
votes
1answer
18 views

change first viewController presented (main interface)

Hello i have done a page controller for my app. This page controller will appear at the app launch if there isn't any "User" core data object on the device. So want i want to do is : When app launch, ...
0
votes
1answer
21 views

Check if an app is pre-installed or protected on OS X

Checking the app by the author 'Apple' isn't a good choice because some other apps from Apple like 'Xcode' or 'Numbers' are not system apps. I also thought about 'Date Added' but it seems not a good ...
0
votes
0answers
49 views

What is wrong with this UIAlertAction code? Won't allow a click/tap and move forward in the app

I'm enrolled in a Swift/iOS Bootcamp course on Udemy. I've not had any issues prior to this one with any of the code or lessons, but this has me stumped. The module is about setting up ...
0
votes
0answers
17 views

Hide scrollview and scrollbar in iOS webkit webview

I just recently migrated my iOS UIWebview objective-c to WKWebkit swift, the problem am facing now is how to hide the scroll bar from the website I loaded. I have tried anything but not of it work, ...
-1
votes
2answers
29 views

Detect numeric year from string using Swift

I am looking for a way to detect years e.g. 2019. The requirements I think would be that the numbers are in a row, have four digits and are not adjacent to letters or special characters. So I'd like ...
-1
votes
0answers
15 views

How to add new Password to sendPasswordReset in firebase? [duplicate]

I need to reset the password when click forgot password button. How to send a new password? user need to type new password right? my code, @IBAction func resetPassword(_ sender: Any) { ...
0
votes
1answer
30 views

Swift 4 decoding/encoding a generic data structure

I have a generic Queue data structure which utilizes an array as its list, I am having hard time making the queue conform to encodable and decodable. I have another class which uses the queue which ...
0
votes
1answer
18 views

Changes to navigationItem displayed with delay

I'm facing a delay when changing properties of a navigationItem inside a ViewController which is embedded in a NavigationController. Consider the example Master-Detail-App provided by XCode: It ...
0
votes
2answers
31 views

How to check the endIndex of a String via IF?

I want the calculator i am making, specifically the backspace button to check if the dot is erased if mainNumberLine.text!.endIndex =="." { } writing that I get the most common error for me "...
-2
votes
4answers
43 views

add comma to string integers in swift

Well after looking a while I could not manage to find a fitting answer to my problem. I have strings containing the digits of the product pricez. For example 1000, 500 or 50. I want them to be ...
0
votes
0answers
23 views

Nothing happen when clicking Google Sign-in button

Update2: Breakpoints don't seem to work because nothing stopped and have the same output 2019-05-25 21:12:10.264321+0700 dacna[6350:1182456] - <AppMeasurement>[I-ACS036002] Analytics screen ...
0
votes
2answers
46 views

Draw in a box in iOS

I'm creating a single page app and I want to include a signature box so my customer can sign on my iPad. I have googled the life out of it and can't figure it out. I'm new to Swift and don't 100% ...
0
votes
0answers
23 views

Loading UIImage in CollectionView Cell movement freezes

I have a UICollectionViewCell with 1 to 3 UIImageView that are managed by a stackView. The Images all have around 8mb. I load them async from CoreData before calling collectionView.reload() In this ...
0
votes
0answers
27 views

Adding two classes with same name to multiple xcodeproject under same workspace

I am new to iOS development. Unlike android i don't have any packages in iOS. My requirement is that I want to add same class(class name) in multiple packages. In android I can create a package and in ...
0
votes
3answers
35 views

TableViews not working with TabBarController Swift

I have an app with a tableView. I decided to add more screens with other tableViews, so I added a tabBarController programatically. Now I get a found nil error on these lines: tableView.delegate =...
0
votes
2answers
39 views

Swift extend protocol by

Hello so I want to implement something similar in swift Kotlin example: class SessionManager( private val freeManager: FreeManager ) : FreeManager by freeManager { } up here FreeManager is ...
0
votes
1answer
19 views

How to fix the speed of calling storyboard in swift code when make a if condition in API?

I have an API that check if username and password are correct when correct come back with value "1" CHK ="1" and when calling and check the value I print console with message , message comes fast when ...
0
votes
2answers
25 views

How to use delete(_:) in Swift4 to Removes the selected content from your interface?

I have created a view programmatically let v = UIView.init() v.frame = CGRect(x:10, y:40, width:100, height:100) v.backgroundcolor = .blue view.addsubview(v) to delete this view I used two ...
0
votes
1answer
27 views

How to transfer a photo from one viewcontroller to a UIImageView of another viewcontroller [duplicate]

I have a tableview, when I click on a cell, I would like to transfer a photo to another ViewController and place it right away in UIImageView Photo transfer override func prepare(for segue: ...
0
votes
0answers
17 views

Why is my (pod setup, pod install) code not executing and showing this error?

(sudo gem install cocoapods) works all ok but when i try (pod setup) shows all these errors I have uninstalled the cocoapods and then reinstalled it but it didn't work. Yasirs-MBP:~ yasiraman$ pod ...
0
votes
1answer
25 views

How to fix uncaught exception in Swift? [duplicate]

terminating with uncaught exception of type NSException override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if let destVC = segue.destination as? StatisticsViewController { ...
0
votes
2answers
26 views

Which is the recommended UIViewController override method where constraints can be initialised?

I am creating UI programatically. I am initialising the UI and adding it as subview in loadView() method. I have categorized method like: initUI() initConstraints() initStyle() I am looking for ...
0
votes
3answers
24 views

Button gradient not working when added to viewDidLayoutSubviews

I am adding a button gradient using the below code extension UIView { func applyGradient(colors: [UIColor]) { self.applyGradient(colors: colors, locations: nil) } func ...
0
votes
1answer
10 views

Where is default source fetch `fetchRequestForSourceEntityNamed:predicateString:` for `NSMigrationManager` defined?

The default source fetch expression sourceExpression FETCH(FUNCTION($manager, "fetchRequestForSourceEntityNamed:predicateString:" , "MyEntity", "TRUEPREDICATE"), $manager.sourceContext, NO) refers to ...
0
votes
2answers
34 views

How the time complexity is calculated for a loop - Swift

I have given two sample for loops with different time complexities. One is Quadratic and the other is Logarithmic. Can anyone help me why the time complexities varies, as both code iterate same number ...
0
votes
0answers
27 views

Indeterminate progress indicator not animating

The progress indicator does not start animating even if I use queues or sleep. I have a function that reads contents of a directory and for each mp3 file it gets the file tags. Also, I read posts ...
0
votes
3answers
38 views

How I can instantly replace presented UIViewController?

I have implemented two different UIViewControllers, that should replace each other based on server respond and user actions. For simplicity let's think that we have two UIViewControllers with button ...
0
votes
1answer
26 views

Incoming push notifications set alerts twice swift 4

I'm implementing Push Notifications via Firebase Cloud Messaging, and when I get the alert on device it actually adverts twice, but on notifications list panel it appears just once as expected. I'm ...
1
vote
1answer
24 views

Continue recording an audio after interrupting by phone call, AVAudioRecorder

How to continue recording an audio after interrupting by incoming phone call? Now after incoming call my record stops, but I want to able to resume recording func audioRecorderDidFinishRecording(_ ...
1
vote
1answer
25 views

Realm Model Conversion Failed

I have a realm db model like: import RealmSwift class User: Object { let isVerified = RealmOptional<Bool>() @objc dynamic var pk = 0 @objc dynamic var profilePicUrl: String? = ...
0
votes
0answers
25 views

How to implement Infinite scrolling on iOS in UITableView with no memory leaks

I want to implement infinite scrolling like in Facebook or Instagram to my application. I am using UITableView and my UITableViewCell contains Title, Description and Image/video. I found a good ...
0
votes
0answers
22 views

How to implement dynamic UItableview inside dynamic UITableviewcell in swift?

I implemented a dynamic UITableView inside UITableViewCell. But only first value of array is populated. The remaining values are not populated. I am using this below code in UIViewController: func ...
0
votes
1answer
30 views

What is the code corresponding to the visual layout constraint?

What is the code corresponding to the visual layout constraint? I want to translate it to NSLayoutConstraint.activate([]) format. scrollView = UIScrollView() scrollView....
0
votes
1answer
30 views

Swift - stopAnimating() - must be used from main thread only

I have a succession of tasks that have to be performed in sequence, so they are corralled by DispatchQueue. To inform the user that they are chugging away I start the activity icon. But how do I stop ...
0
votes
1answer
24 views

UICollectionView not scrolling after custom UIView added to view

I'm trying to add a custom UIView after adding a UICollectionView because I wanna show the custom bar view above the collection view. This is my code: func loadFilters() { let ...
1
vote
1answer
16 views

Vapor Fluent Database transaction is not atomic

I'm creating a database transaction with several insertions inside it. Results are saving as array of Future. Then I'm looking for the operation results in do{..}.catch{..} construction. And here is ...
0
votes
1answer
20 views

Pass outlet Data from TableViewCell to ViewController.swift

Getting error Unexpectedly found nil while unwrapping an Optional value while trying to pass data from tableviewcell to viewcontroller DataCell.swift @IBOutlet weak var containerView: UIView! ...
-1
votes
0answers
18 views

In TableView, didHighlightRowAt and didUnhighlightRowAt returns the same result, why?

When attempting to keep track of highlighted rows in a TableView I try using these two functions. But both returns the same result at the same time. Is there something we missed. Should not one ...
0
votes
1answer
32 views

for loop in SwiftyJSON Response

I have a JSON response from Alamofire. I want populate my tableviews rolls with the JSON but only one roll is displayed. other JSONs are not loaded into to custom tableView cells If ...
-1
votes
0answers
11 views

UICollectionView at a specific indexpath with paging

How to load UICollectionView first time at a specific IndexPath with paging enabled self.collection_Timeslot.scrollToItem(at:indexPath , at: .left, animated: false)
-2
votes
0answers
25 views

How to get the values from Dictionary in ios swift

Dcit = { 5cdc00e84feb5b1d0c8772f6 = { contactStatus = known; img ="/images/profileimg/blank-profile.png"; mob ="+91656565465"; ...
0
votes
1answer
21 views

How to use custom navigation to handle multiple ViewControllers?

I would like to use custom navigation to handle multiple ViewControllers at once. How would I be able to achieve this? Below is what I have so far: let naviagationController = ...
0
votes
1answer
20 views

Swift Background task on applicationWillTerminate

I am using call kit and voip calling. I have case when user is in call and user terminate app from background then I wanted to perform some small operations like leave the calling channel, save the ...

http://mssss.yulina-kosm.ru