Setting breakpoints in Xcode and debugging the program will output the following information in the console. The first breakpoint debugging is triggered every time you compile and run the program. Furthermore, loading variables during breakpoint debugging takes a very long time.
Why is this information outputted? And why does it take so long
warning: (arm64) /Users/xxx/Library/Developer/Xcode/DerivedData/MYApp-edwwubwxxruxpddmfzegvkdqhppk/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/FBKVOController/FBKVOController.framework/FBKVOController(FBKVOController.o) '/var/folders/45/h0vrkd951jjbc538flwxctqc0000gn/C/clang/ModuleCache/2OX0YH8X0GZ6V/UIKit-HKJAGZJT5Z2N.pcm' does not existwarning: (arm64)
Environment
Xcode Version 16.4 (16F6) + any iPhone device
UIKit
RSS for tagConstruct and manage graphical, event-driven user interfaces for iOS or tvOS apps using UIKit.
Posts under UIKit tag
200 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
1, Devices
Apple TV HD tvOS 18.5 (22L572) Mode(A1625)
HomePod Gen1 OS18.5 (22L572)
2, Test cases:
2.1 UIViewController + AVPlayerLayer + AVPlayer
Result: Can not AirPlay to HomePod
Sample code for UIViewController + AVPlayer
2.1 AVPlayerViewController + AVPlayer
Result: Can AirPlay to HomePod
Sample code for AVPlayerViewController + AVPlayer
In our project, we defined a CustomTabBar that inherits UITabBar, and we add some subviews and these subviews' frame is beyond UITabBar, see below picture(a beyond area button, this button is a subview of UITabBar, but frame is out of UITabBar's area):
and in order to let this button response to click action, we override the UITabBar's hitTest method, this works well below OS 26 with Xcode version below 26:
override public func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
let pointInCollectionView = self.beyondAreaButton.convert(point, from: self)
if self.beyondAreaButton.bounds.contains(pointInCollectionView) {
return self.beyondAreaButton.hitTest(pointInCollectionView, with: event)
}
return super.hitTest(point, with: event)
}
but when using Xcode26 build app on OS 26, I noticed the UITabBar is wrapped by a UIKit._UITabBarContainerView and UIKit._UITabBarContainerWrapperView, and it can not trigger the hitTest method.
since the hitTest is not triggered, so the button action is no chance to trigger too.
Any suggestions to solve this problem, thank you~
And I have file a feedback assistant: FB19252973
Per default the menu bar on iPad includes an application menu named after your app which includes a Preferences action. That one opens the Settings app to your app settings page.
I do not really populate that with options and instead have my own settings UI accessible in my app using toolbar items.
What's the best approach to handle this with the menu bar?
I've tried replacing the default Preferences item but that only works if I do not use its shortcut, which I would like to preserve.
Another solution would be to append another Settings item for my UI, which would look weird and confusing, but seems to be the recommended way from the HIG.
Reserve the YourAppName > Settings menu item for opening your app’s page in iPadOS Settings. If your app includes its own internal preferences area, link to it with a separate menu item beneath Settings in the same group. Place any other custom app-wide configuration options in this section as well.
I take it there is no way to replace it then?
I'm trying to support the new menu bar in iPadOS 26.
In AppDelegate I do this. I want to this to be a global command, which can work regardless of which view controller is currently visible, so I let the AppDelegate handle the selector (if there's a better way let me know).
UIMainMenuSystem.shared.setBuildConfiguration(config) { builder in
let createCollectionCommand = UIKeyCommand(
title: String(localized: "Create Collection"),
image: UIImage(systemName: "folder.badge.plus"),
action: #selector(AppDelegate.showCreateCollectionViewController),
input: "c",
modifierFlags: .control
)
builder.insertElements([createCollectionCommand], atEndOfMenu: .file)
}
This works mostly.
A problem arrises when I have multiple windows open at the same time. I need a way to determine the currently active window scene from AppDelegate to display a sheet on that window's root view controller.
There's stuff like this, but unfortunately all visible windows have activationState == .foregroundActive, so I cannot use that.
guard let scene = UIApplication.shared.connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene else { return }
So, how do I do multi-window global commands? I'm basically looking for something like the "Create Playlist" command in the Music app.
Hi everyone,
I’m currently working on a UITableView setup that uses UITableViewDiffableDataSource. Each cell contains two views:
A UILabel for a title
A WKWebView that loads dynamic HTML content
My Current Approach:
On initial load, I let all cells render with default height.
As each WKWebView finishes loading, I calculate its content height using JavaScript and store this height in a [String: CGFloat] dictionary keyed by a unique identifier for each WebView.
I then call tableView.performBatchUpdates to trigger a layout update and resize the cell.
When the same cell index and data are shown again, I retrieve the cached height from the dictionary and apply it as a constraint on the WKWebView before loading its content.
This mostly works, but occasionally, there are visual glitches — such as flickering during scrolling or incorrect cell heights temporarily shown before the height is re-applied.
My Questions:
Is this a recommended or sustainable way for handling WKWebView inside a UITableViewCell, especially with DiffableDataSource?
Are there any known best practices or alternatives to manage dynamic web content heights more smoothly in table cells?
Is it possible that the glitches are caused by layout timing issues or reentrancy of height calculation and rendering?
Any suggestions, refinements, or architectural recommendations would be greatly appreciated.
Thanks in advance!
When compiled on Xcode 16.4.0:
When compiled on Xcode 26:
The code:
import SwiftUI
struct SearchBarController: UIViewRepresentable {
@Binding var text: String
var placeholderText: String
class Coordinator: NSObject, UISearchBarDelegate {
@Binding var text: String
init(text: Binding<String>) {
_text = text
}
func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
text = searchText
}
}
func makeUIView(context: Context) -> UISearchBar {
let searchBar = UISearchBar(frame: .zero)
searchBar.delegate = context.coordinator
searchBar.placeholder = placeholderText
searchBar.searchBarStyle = .minimal
return searchBar
}
func updateUIView(_ uiView: UISearchBar, context: Context) {
uiView.text = text
}
func makeCoordinator() -> SearchBarController.Coordinator {
return Coordinator(text: $text)
}
}
I am creating 500 textfield widgets and then updating them and all their 40 properties at once. I require to update all 500 widgets with their properties at once as it is a usecase in our app, so pooling and showing only those that will be on screen won't really help in this case.
I have found that for updating all these 500 textfield widgets with their 40 properties, the time taken is 80 to 100 milliseconds.
However, if I update the non-string properties like .text, then it comes down to half which is 40 to 50 milliseconds.
Wanted to know if there was a far more quicker or optimized way to do this?
The following snippet of code shows what I am doing:
@objc private func handleImmediateMode() {
let startTime = CFAbsoluteTimeGetCurrent()
for (index, textField) in retainedInputFields.enumerated() {
updateAllProperties(for: textField, index: index)
}
let endTime = CFAbsoluteTimeGetCurrent()
print("Immediate Mode -- (500 fields, 40 props): \( (endTime - startTime) * 1000) ms")
}
In the above code, I have already created the 500 textfield widget, and then in updateAllProperties () function I am passing the textfield widget to it and then updating the 40 properties that the widget has.
Particularily, the following properties:
textField.placeholder = "Input Field (index)"
UILabel().text
Seem to be adding the extra 40 - 50 milliseconds.
prefetching logic for UICollectionView on VisionOS does not work.
I have set up a Standalone test repo to demonstrate this issue. This repo is basically a visionOS version of Apple's guide project on implementation of prefetching logic.
in repo you will see a simple ViewController that has UICollectionView, wrapped inside UIViewControllerRepresentable.
on scroll, it should print 🕊️ prefetch start on console to demonstrate func collectionView(_ collectionView: UICollectionView, prefetchItemsAt indexPaths: [IndexPath]) is called. However it never happens on VisionOS devices.
With the same code it behaves correctly on iOS devices
Topic:
Spatial Computing
SubTopic:
General
Tags:
SwiftUI
UIKit
visionOS
iPad and iOS apps on visionOS
I want to understand what the recommended way is for string interoperability between swift and c++. Below are the 3 ways to achieve it. Approach 2 is not allowed at work due to restrictions with using std libraries.
Approach 1:
In C++:
char arr[] = "C++ String";
void * cppstring = arr;
std::cout<<"before:"<<(char*)cppstring<<std::endl; // C++ String
// calling swift function and passing the void buffer to it, so that swift can update the buffer content
Module1::SwiftClass:: ReceiveString (cppstring, length);
std::cout<<"after:"<<(char*)cppstring<<std::endl; // SwiftStr
In Swift:
func ReceiveString (pBuffer : UnsafeMutableRawPointer , pSize : UInt ) -> Void
{
// to convert cpp-str to swift-str:
let swiftStr = String (cString: pBuffer.assumingMemoryBound(to: Int8.self));
print("pBuffer content: \(bufferAsString)");
// to modify cpp-str without converting:
let swiftstr:String = "SwiftStr"
_ = swiftstr.withCString { (cString: UnsafePointer<Int8>) in
pBuffer.initializeMemory(as: Int8.self, from: cString, count: swiftstr.count+1)
}
}
Approach 2:
The ‘String’ type returned from a swift function is received as ‘swift::String’ type in cpp. This is implicitly casted to std::string type. The std::string has the method available to convert it to char *.
void
TWCppClass::StringConversion ()
{
// GetSwiftString() is a swift call that returns swift::String which can be received in std::string type
std::string stdstr = Module1::SwiftClass::GetSwiftString ();
char * cstr = stdstr.data ();
const char * conststr= stdstr.c_str ();
}
Approach 3:
The swift::String type that is obtained from a swift function can be received in char * by directly casting the address of the swift::String. We cannot directly receive a swift::String into a char *.
void
TWCppClass::StringConversion ()
{
// GetSwiftString() is a swift call that returns swift::String
swift::String swiftstr = Module1::SwiftClass::GetSwiftString ();
// obtaining the address of swift string and casting it into char *
char * cstr = (char*)&swiftstr;
}
I disable 4 or 5 Finger Gestures on Settings.app > Multi-tasking and Gestures.
But in the third-party apps, 4-5 finger touches are sometimes immediately cancelled.
Especially, 4-5 finger swipe gesture.
I filed this issue to FB19226717.
I develop Piano instrument app. 4 or 5 finger touches are required for that kind of apps. Please fix this, Apple.
when using CNContactViewController to present a contact detail info, the system CNContactViewController appear some UI issues.
On iOS 26, the Poster avatar overlaps with the title "Edit device contact"
On iPadOS26 with device(not simulator), when click 'Add photo', the CNContactViewController will auto dismiss, and the console output some error log:
below are the sample code:
AppDelegate.swift:
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
let window: UIWindow = UIWindow()
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let vc = SplitViewController(primary: TabBarViewController(), secondary: ViewController())
window.rootViewController = vc
window.makeKeyAndVisible()
return true
}
}
SplitViewController.swift:
import UIKit
class SplitViewController: UISplitViewController {
init(primary: UIViewController, secondary: UIViewController) {
super.init(nibName: nil, bundle: nil)
preferredDisplayMode = .oneBesideSecondary
presentsWithGesture = false
delegate = self
viewControllers = [primary, secondary]
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
}
}
extension SplitViewController: UISplitViewControllerDelegate {
}
TabBarViewController.swift:
import UIKit
class BaseViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
}
class HomeViewController: BaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .red
navigationItem.title = "Home"
tabBarItem = UITabBarItem(title: "Home", image: UIImage(systemName: "house"), tag: 0)
}
}
class TabBarViewController: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
let homeVC = HomeViewController()
let homeNav = UINavigationController(rootViewController: homeVC)
viewControllers = [homeNav]
ContactManager.shared.getAllContactIdentifiers()
}
}
ViewController.swift:
import UIKit
import Contacts
import ContactsUI
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .systemPink
let button = UIButton(frame: .zero)
button.backgroundColor = .orange
button.setTitle("show contact", for: .normal)
button.addTarget(self, action: #selector(showContactInfo), for: .touchUpInside)
button.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(button)
button.widthAnchor.constraint(equalToConstant: 200).isActive = true
button.heightAnchor.constraint(equalToConstant: 60).isActive = true
button.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
button.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
}
@objc private func showContactInfo() {
print("showContactInfo")
let identifier = ContactManager.shared.identifiers[0]
let currentContact = try? CNContactStore().unifiedContact(withIdentifier: identifier, keysToFetch: [CNContactViewController.descriptorForRequiredKeys()])
guard let contact: CNMutableContact = currentContact?.mutableCopy() as? CNMutableContact else {
return
}
let vc = CNContactViewController(forNewContact: contact)
vc.delegate = self
vc.title = "Edit Device Contact"
vc.allowsActions = false
vc.contactStore = CNContactStore()
let navigationVC: UINavigationController = UINavigationController(rootViewController: vc)
let appDelegate = UIApplication.shared.delegate as? AppDelegate
appDelegate?.window.rootViewController?.present(navigationVC, animated: true, completion: nil)
}
}
extension ViewController: CNContactViewControllerDelegate {
public func contactViewController(_ viewController: CNContactViewController, didCompleteWith contact: CNContact?) {
viewController.dismiss(animated: true, completion: nil)
}
}
Hi all,
I'm running into a UIKit issue specific to iOS 26 (Xcode 26 Beta 4) where UIAlertAction buttons that are disabled using .isEnabled = false do not appear visually disabled. The alert still shows the action with full opacity and default styling, making it look like the button is tappable — even though it isn't.
❗ Issue:
On iOS 26, disabled actions in UIAlertController no longer appear dimmed or inactive. This is a visual regression compared to iOS 18 and earlier, where disabled actions would automatically appear grayed out and visually distinct.
Hey everyone,
Just wanted to share a critical issue we’ve encountered while testing our app on iOS 18 simulators and devices using Xcode 26 Beta 3:
Crash Details
We're seeing the following fatal exception during launch:
NSInvalidUnarchiveOperationException
Could not instantiate class named _TtGC5UIKit17UICoreHostingViewVCS_21ToolbarVisualProvider8RootView_ because no class named _TtGC5UIKit17UICoreHostingViewVCS_21ToolbarVisualProvider8RootView_ was found...
The crash originates from Storyboards/XIBs that include a UIToolbar. It appears UIKit is referencing an internal SwiftUI-related class (UICoreHostingView), which isn't present at runtime — leading to immediate crashes.
Affected:
Apps using UIToolbar in Storyboards or XIBs
Running on iOS 18 (Simulators or Devices) and below
Built using Xcode 26 Beta 3
CrashLog:
Fatal Exception: NSInvalidUnarchiveOperationException
0 CoreFoundation 0x11a21c __exceptionPreprocess
1 libobjc.A.dylib 0x31abc objc_exception_throw
2 CoreFoundation 0x178ea0 -[NSException initWithCoder:]
3 UIFoundation 0x28774 UINibDecoderDecodeObjectForValue
4 UIFoundation 0x28a18 UINibDecoderDecodeObjectForValue
5 UIFoundation 0x28cac -[UINibDecoder decodeObjectForKey:]
6 UIKitCore 0x21e680 -[UIView initWithCoder:]
7 UIKitCore 0x9b4784 -[UIToolbar initWithCoder:]
8 UIFoundation 0x28890 UINibDecoderDecodeObjectForValue
9 UIFoundation 0x28cac -[UINibDecoder decodeObjectForKey:]
10 UIKitCore 0x1e3a80 -[UIRuntimeConnection initWithCoder:]
11 UIFoundation 0x28890 UINibDecoderDecodeObjectForValue
12 UIFoundation 0x28a18 UINibDecoderDecodeObjectForValue
13 UIFoundation 0x28cac -[UINibDecoder decodeObjectForKey:]
14 UIKitCore 0x1e87dc -[NSCoder(UIIBDependencyInjectionInternal) _decodeObjectsWithSourceSegueTemplate:creator:sender:forKey:]
15 UIKitCore 0x1e2ea4 -[UINib instantiateWithOwner:options:]
16 UIKitCore 0x9f96c -[UIViewController loadView]
17 UIKitCore 0x75da8 -[UIViewController loadViewIfRequired]
18 UIKitCore 0x14430 -[UIViewController view]
19 UIKitCore 0x4237bc -[UINavigationController _preferredContentSizeForcingLoad:]
20 UIKitCore 0x116b15c -[_UISheetPresentationMetrics formSheetSizeForViewController:windowSize:screenSize:]
21 UIKitCore 0xb5c60c -[UIViewController _formSheetSizeForWindowWithSize:screenSize:]
22 UIKitCore 0x546ebc -[_UISheetLayoutInfo _preferredSize]
23 UIKitCore 0x18da60 -[_UISheetLayoutInfo _isEdgeAttached]
24 UIKitCore 0x19d428 -[_UISheetLayoutInfo _margins]
25 UIKitCore 0x19ce88 -[_UISheetLayoutInfo _stackAlignmentFrame]
26 UIKitCore 0x211018 -[_UISheetLayoutInfo _fullHeightUntransformedFrame]
27 UIKitCore 0x18f39c -[_UISheetLayoutInfo _untransformedFrame]
28 UIKitCore 0x188350 -[UISheetPresentationController _containerViewLayoutSubviews]
29 UIKitCore 0x18f1fc -[UITransitionView layoutSubviews]
30 UIKitCore 0x26070 -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
31 QuartzCore 0x14c14 CA::Layer::layout_if_needed(CA::Transaction*)
32 UIKitCore 0x16b78 -[UIView(Hierarchy) layoutBelowIfNeeded]
33 UIKitCore 0x186f4c -[UISheetPresentationController presentationTransitionWillBegin]
34 UIKitCore 0x3187b4 -[_UIFormSheetPresentationController presentationTransitionWillBegin]
35 UIKitCore 0x185dd0 __80-[UIPresentationController _initViewHierarchyForPresentationSuperview:inWindow:]_block_invoke
36 UIKitCore 0x1874f8 __77-[UIPresentationController runTransitionForCurrentStateAnimated:handoffData:]_block_invoke_3
37 UIKitCore 0x8584c -[_UIAfterCACommitBlock run]
38 UIKitCore 0x85784 -[_UIAfterCACommitQueue flush]
39 UIKitCore 0xa254 _runAfterCACommitDeferredBlocks
40 UIKitCore 0x9f74 _cleanUpAfterCAFlushAndRunDeferredBlocks
41 UIKitCore 0x9e84 _UIApplicationFlushCATransaction
42 UIKitCore 0x9e0c __setupUpdateSequence_block_invoke_2
43 UIKitCore 0x9404 _UIUpdateSequenceRun
44 UIKitCore 0x8ab4 schedulerStepScheduledMainSection
45 UIKitCore 0x41e4 runloopSourceCallback
46 CoreFoundation 0xfa8c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
47 CoreFoundation 0xf8a4 __CFRunLoopDoSource0
48 CoreFoundation 0xf700 __CFRunLoopDoSources0
49 CoreFoundation 0x10080 __CFRunLoopRun
50 CoreFoundation 0x11c3c CFRunLoopRunSpecific
51 GraphicsServices 0x1454 GSEventRunModal
52 UIKitCore 0x135274 -[UIApplication _run]
53 UIKitCore 0x100a28 UIApplicationMain
54 Saleslink DEV 0x1f9ea8 main + 17 (AppDelegate.swift:17)
55 ??? 0x1af61bf08 (Missing)
Would love to know if anyone else has encountered this, or if there’s an official radar or feedback ID we can follow. Hoping this gets resolved before the GM release of Xcode 26.
Thanks!
On WWDC25 session "Meet Liquid Glass", two Liquid Glass variants are mentioned: "regular" and "clear". "Regular" seems to be the default setting for UIGlassEffect, but I was not able to find an option for clear.
Is there a native element that uses clear? Is it coming to later betas for iOS 26?
Hello everyone, I am having an issue where the attributed text that I have in my UITextView is not scaling dynamically with phone text size, whenever I remove the attributed text logic, it scales fine, however, with it, it stays at a set font size.
struct AutoDetectedClickableDataView: UIViewRepresentable {
let text: String
@Binding var height: CGFloat
func makeUIView(context: Context) -> UITextView {
let textView = UITextView()
textView.dataDetectorTypes = [.phoneNumber, .address, .link]
textView.isEditable = false
textView.isScrollEnabled = false
textView.backgroundColor = .clear
textView.font = UIFont.preferredFont(forTextStyle: .body) /*UIFontMetrics(forTextStyle: .body).scaledFont(for: UIFont.systemFont(ofSize: 16.0)) */
textView.adjustsFontForContentSizeCategory = true
textView.textContainer.lineBreakMode = .byWordWrapping
textView.textContainerInset = .zero
textView.textContainer.lineFragmentPadding = 0
textView.translatesAutoresizingMaskIntoConstraints = false
textView.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
textView.setContentHuggingPriority(.defaultHigh, for: .horizontal)
return textView
}
func updateUIView(_ uiView: UITextView, context: Context) {
let attributed = NSMutableAttributedString(string: text, attributes: [
.font: UIFont.preferredFont(forTextStyle: .body)
])
let detector = try? NSDataDetector(types: NSTextCheckingResult.CheckingType.address.rawValue |
NSTextCheckingResult.CheckingType.link.rawValue |
NSTextCheckingResult.CheckingType.phoneNumber.rawValue)
detector?.enumerateMatches(in: text, options: [], range: NSRange(location: 0, length: text.utf16.count)) { match, _, _ in
guard let match = match else { return }
attributed.addAttributes([
.foregroundColor: UIColor.systemBlue,
.underlineStyle: NSUnderlineStyle.single.rawValue,
], range: match.range)
}
uiView.attributedText = attributed
// uiView.text = text
DispatchQueue.main.async {
uiView.layoutIfNeeded()
let fittingSize = CGSize(width: uiView.bounds.width, height: .greatestFiniteMagnitude)
let size = uiView.sizeThatFits(fittingSize)
height = size.height
}
}
}
Hi everyone,
I've noticed that on iOS 26 beta 1 through beta 4, when using a List with the .plain style, the section header overlaps with the cell content below it, as there is no background for the header. This creates a poor visual experience.
Additionally, when using NavigationSplitView on iPad, the second column's list always shows this issue.
Is this an intentional design change, or just a temporary issue? I haven't found a good workaround so far.
Thanks!
FB19066489
Fellow iOS developers, can you tell me how to make UIDatePicker usable on iOS 26?
Hi,
I'm seeing an issue in iOS 26 beta related to UINavigationBar rendering in landscape.
When a background color is set for the navigation bar and the device is rotated to landscape, an unexpected gap appears above the navigation bar.
This also happens in the official sample project provided in Apple’s documentation:
https://developer.apple.com/documentation/uikit/customizing-your-app-s-navigation-bar
Is this a bug in the beta, or is there a workaround to avoid this behavior?
Thanks in advance!
This may seem really basic, but I'm not using the screen designer, I'm doing this old school (programmatically).
I think I'm using Swift 5 (not actually sure). This image may help.
So I created my own UIImageView class called GenericImage
class GenericImage: UIImageView, @unchecked Sendable { ... }
I create the GenericImage class and add it to the View Controller. Then I load the image and set some positioning within my GenericImage class
let imageView = GenericImage(frame: CGRect.zero)
self.view.addSubview(imageView)
imageView.processResponse(componentDictionary )
In the GenericImage class I load the image and set some constraints.
self.imageFromURL(urlString: imageUrl)
self.translatesAutoresizingMaskIntoConstraints = false
self.contentMode = .scaleAspectFit
self.widthAnchor.constraint(equalToConstant: 100.0).isActive = true
self.heightAnchor.constraint(equalToConstant: 100.0).isActive = true
self.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true
self.topAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
The image is displayed at the top left of the screen.
I'm guessing that the code I have written should center the image on the screen. However, while I would like to know how to center the image, I also want to be able to position it at a specific place on the screen, using points (or pixels).
Any suggestions?