Save string to the NSUserDefaults?

How to save a string into the NSUserDefaults?

How can I create a UILabel with strikethrough text?

I want to create a UILabel in which the text is like this How can I do this? When the text is small, the line should also be small.

NSFileManager fileExistsAtPath:isDirectory and swift

I'm trying to understand how to use the function fileExistsAtPath:isDirectory: with Swift but I get completely lost. This is my code example: var b:CMutablePointer<ObjCBool>? if...

Swift- Remove Push Notification Badge number?

I am trying to remove the icon badge in swift, but PFInstallation doesn't seem to work anymore. How do I do this?

How can I change the UISearchBar search text color?

How can I change the text color of a UISearchBar?

How to compare enum with associated values by ignoring its associated value in Swift?

After reading How to test equality of Swift enums with associated values, I implemented the following enum: enum CardRank { case Number(Int) case Jack case Queen case King case...

How to convert a Swift object to a dictionary

I'm relatively new to iOS programming. However, I would have assumed that Swift would have an automated way of converting objects to JSON and vice versa. That being said, I have found several...

Change UIBarButtonItem Icon after pressed iOS swift

In the viewDidload method, I've declared a button and set RightBarButton... let btnFavourite = UIButton(frame: CGRectMake(0,0,30,30)) btnFavourite.addTarget(self, action: "btnFavourite:",...

Handle timeout with Alamofire

Is it possible to add timeout handler for Alamofire request? In my project I use Alamofire this way: init() { let configuration = NSURLSessionConfiguration.defaultSessionConfiguration() ...

FirebaseStorage: How to Delete Directory

FirebaseStorage always returns error 400 when I try to delete a directory i.e. something like the following always returns error 400. let storageRef =...

How can I decode JWT (JSON web token) token in Swift?

I have a JWT token like this eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ How can I...

Does a Universal Link persists POST data?

I need to get the POST data for a Universal Link. How do I capture this in iOS?

iTunes Store operation failed. No suitable application records were found. Verify your bundle identifier ‘org.cocoapods.Alamofire’ is correct

I’m trying to upload binary to iTunesConnect using Xcode8.3. There are around 10 cocoa pods (Alamofire, SideMenuController, DropDown etc) in my project. However, while uploading I’m getting...

Protocol can an only be used as a generic constraint because it has Self or associated type requirements

Following on from an answer to my previous question, I have 2 protocols… protocol Filters: Encodable { } protocol QueryParameters: Encodable { associatedtype T: Filters var page: Int {...

Apple Recommended Logging approach for Swift

Note: This is not a duplicate of the linked questions Goal: I am not looking for a print vs NSLog differences In fact I don't want to use either of them (presently using print) I am looking for...

How to use autoFill with keychain access in WKWebView

In i0S 11.0 introduce username and password autofill in apps but I found post on reddit that it is possible to use it also in WKWebView but couldn't find any description how to use it, how to let...

Swift 4.2) Mutate array of struct with for_in/forEach vs. access by index

I am trying to modify struct element in array. I found that you can do that by accessing(iterate) the struct by index, but you can't if you use 'for in' loop or forEach{}. struct Person { var...

Share a message with telegram within iOS app (Swift)

I'm developing an iOS app with swift and I need to share a message with the telegram app when a button is pressed. I want the user to choose which contact he/she wants to share the message...

SwiftUI - Half modal?

I'm trying to recreate a Modal just like Safari in iOS13 in SwiftUI: Here's what it looks like: Does anyone know if this is possible in SwiftUI? I want to show a small half modal, with the option...

Command PhaseScriptExecution failed with a nonzero exit code while trying to add Flutter to iOS app

I am trying to add flutter to the existing app. So before doing on the production app I tried with brand new Xcode 10 Single View Application. I followed the tutorial here on...

Swift: Change status bar color for iOS 13

For ios 13 I can't set text color of the status bar. How I can get the view of statusBarManager? How I can change the text color only? due to: Terminating app due to uncaught exception...

Receiving push notifications from iCloud on Apple Watch

I have an app that supports both iOS and watchOS. They operate on data stored in iCloud. What I am trying to do is receive notifications on the Apple Watch when data changes on the iCloud server...

Swift 5 Firestore: Checking if collection exists in database

I'm trying to check if a certain collection exists in my Firestore database, and here is my code for doing so: let db = Firestore.firestore() ...

AuthenticationInterceptor(Alamofire5.2) retry process doesn't work well

I have a question about the AuthenticationInterceptor added in Alamofire 5.2. I am using AuthenticationInterceptor to refresh the oAuth...

SwiftUI View and UIHostingController in UIScrollView breaks scrolling

When I add a UIHostingController which contains a SwiftUI view as a childView, and then place that childView inside a UIScrollView, scrolling breaks. Here I have my View struct TestHeightView:...

How to restrict input to TextField to take only numbers between 0-10 in SwiftUI?

I have looked at different answers to this question but I am confused. I am relatively new to Swift. I am currently working on my senior project for school. Would love someone to answer the...

SwiftUI picker with no title

I'm trying to add a simple picker functionality by SwiftUI. Essentially the outcome I'm looking for is something like this: When clicking on the arrow, it should take user to a new view where...

No such module error in Xcode 12.4 Apple M1

In My Xcode 12.4 I can't build my projects anymore. Each time I do I get "No such module..." for each Pod. I haven't made any other changes to the project. I've cleaned, deleted Derived Data,...

iOS 15 Communication Notification picture not shown

I've been trying to update my (local & push) notifications to Communication notifications. When a user receives a communication event from one of their friend, I want the displayed notification to...

Updates changes for nested models

ObservableObject doesn't emit change events for nested observables by default. Here a nested settings object within a view model, which is then observed by a view. In this small example, the menu...