Category "swift"

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

How to scroll particular views under the scrollview in ios using swift?

I have views like below 75% view is Scrollview and 25% is Bottom Imageview. childView which is inside scrollviews My Screen UI I tried below code as w

SceneKit – What's the difference between SCNAction and CABasicAnimation?

I'm still very new to SceneKit and SpriteKit and just started working on animating some SCNNodes. One thing I don't get is when to use SCNAction and when to us

Show Current Location and Update Location in MKMapView in Swift

I am learning how to use the new Swift language (only Swift, no Objective-C). To do it, I want to do a simple view with a map (MKMapView). I want to find and up

How to achieve realistic Depth of Field effect in SceneKit?

I'm trying to render a frame, with realistic depth of field effect. I've already tried the depth of field properties in the camera node, but it doesn't produce