Category "swift"

How to make a gradient circular path in Swift

I want to create a gradient circular path like the following image: and I have the following code: circularPath = UIBezierPath(arcCenter: .zero, radius:

Need to check that braces in given array are balanced or not

Braces in a string are considered to be balanced if they met the following conditions, All braces must be closed. braces come in a pair of the form of (), {},

MapAnnotation, how can we decide the zIndex of an Annotation?

when using the MapKit.Map to display multiple Annotation overlapping, everything works properly whether you use MapPin, MapMarker or MapAnnotation. The tricky p

How to check is a string or number

I have an array ["abc", "94761178","790"] I want to iterate each and check is a String or an Integer? How to check it ? How to convert "123" to integer 123

How to save a color in NSUserDefaults in swift?

I have a litle problem with saving a color in NSUserDefaults . In objective-c is easy : -(NSColor *)colorForKey:(NSString *)key{ NSData *data; NSColor *color

Get class name of UIViewController in swift

How do you get the class name of a UIViewController class in Swift? In Objective-C, we can do something like this: self.appDelegate = (shAppDelegate *)[[UIAppli

Unique Identifier for scheduling notifications, Swift 3 iOS 10

I am scheduling notifications with Unique Identifiers so I don't have to make a new String for each notification. This all works well for scheduling but the pro

How to round a Double to the nearest Int in swift?

I'm trying to make a calculator of growth rate (Double) that will round the result to the nearest Integer and recalculate from there, as such: let firstUsers =

dispatchGroup.notify(queue: inheriting QOS from the current context

Is there a way to dispatchGroup.notify(queue: inheriting QOS from the current context? (assuming there IS qos metainfo that's dragged through all the contexts t

SwiftUI - menu not appearing and double toolbar for NavigationView

I am creating a iOS app with XCode. All source code has been written and compiled. The app runs in the iOS simulator. The user interface was created in SwiftUI

How to use NSLocalizedString function with variables in Swift?

I'm trying to localize my app using NSLocalizedString. When I import the XLIFF file, most works like a charm but something do not and some string is not localiz

Center NSTextAttachment image next to single line UILabel

I'd like to append an NSTextAttachment image to my attributed string and have it centered vertically. I've used the following code to create my string: NSMuta

How to set the correct height for a UIDatePicker?

How do I set the height of a datePicker correctly across the range of different iOS devices? I can get the width from the width of the window but not the height

How to get a swift enum's associated value regardless of the enum case

I have an object FormField which has two properties: a String name, and a value which can accept any type--hence I've made it Any!. However, I've been told in a

MTAudioProcessingTap EXC_BAD_ACCESS , doesnt always fire the finalize callback. how to Release it?

Im trying to implement MTAudioProcessingTap and it works great. The problem is when Im done using the Tap and I reinstaniate my class and create a new Tap. Ho

(eSIM Integration iOS) How to use restricted API "addPlan" to enable e-sim profile in iOS device

After searching everywhere I found there is a way to add eSIM in iPhone using the following API func addPlan(with: CTCellularPlanProvisioningRequest, completi

using avplayerkit issue while playing video black screen coming

hello i am new to swift and i am using AVPlayerViewController for plaing video from my url but issue is that i am not able to load video only black screen showi

UITableViewRowAction vs UISwipeActionsConfiguration

The two APIs seem to get the same result. In which case is it better to use one over the other? override func tableView(_ tableView: UITableView, editActionsFo

bg color of view controller status bar area in UIViewControllerRepresentable

I am using a UIViewControllerRepresentable for a view controller that can accomplish things I can't do in SwiftUI. I am trying to get the status bar area appear

Swift Combine - Accessing separate lists of publishers

I have two lists of URLs that return some links to images. The lists are passed into a future like static func loadRecentEpisodeImagesFuture(request: [URL]) -&g