Error:
Fatal error: init(coder:) has not been implemented
File:
UIKitCore/UICoreHostingView.swift:54
Stack Trace Snippet:
swift
Copy
Edit
UIKitCore/UICoreHostingView.swift:54: Fatal error: init(coder:) has not been implemented
Can't show file for stack frame: <DBGLldbStackFrame: 0x10ca74560> - stackNumber: 23
name: @objc ThemeableViewController.init(coder:).
The file path does not exist on the file system: /
UIKit
RSS for tagConstruct and manage graphical, event-driven user interfaces for iOS or tvOS apps using UIKit.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I am using UISheetPresentationController to show bottom sheets like the one in Apple Maps. It works very well.
In Apple Maps, there is a weather indicator that sits on top of the presented sheets and follows it (to a point) when the sheet is dragged up or down. I would like to mimic this behavior for my own bottom sheets to have content from the presenting view controller stay visible while the sheet is presented.
How do I do this? Is this even possible? I think I'm looking for some kind of layout guide that sits on top of the presented sheet.
Topic:
UI Frameworks
SubTopic:
UIKit
I noticed that trying to access safeAreaInsets from the active window causes an infinite run loop.
This issue appeared after updating to Beta 3.
Here’s an example of the code:
extension UIDevice {
var safeAreaInsets: UIEdgeInsets {
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
let window = windowScene.windows.first(where: { $0.isKeyWindow }) else {
return .zero
}
return window.safeAreaInsets
}
}
The return doesn’t happen because it ends up in some kind of recursion.
I’ve implemented a basic custom view controller presentation: the presented view controller slides up from the bottom in a manner similar to UISheetPresentationController, and can be dismissed by tapping the dimming view added on top of the presenting view controller.
I want my custom presentation to be interruptible, so the user should be able to tap the dimming view while the presentation transition is in progress to smoothly convert the presentation transition into a dismissal transition. I’m using additive spring animations (by virtue of UIViewPropertyAnimator) here to make the change in direction less jarring.
Unfortunately, it seems that the interruption-triggered dismissal transition is abruptly terminated by the system based on some kind of timer. The later in the presentation transition I tap the dimming view, the earlier the dismissal transition is terminated.
Steps to reproduce
After launching the test project:
Tap the “Present” button.
Tap the dimming view just before the transition completes.
The test project includes a screen recording of the broken behavior.
I’m using the new preferredTransition = .zoom(...) API introduced in iOS 18.
Here’s a simplified version of what I do on app startup:
let listVC = CollectionViewController(collectionViewLayout: layout)
let detailVC = DetailViewController()
detailVC.preferredTransition = .zoom(sourceViewProvider: { context in
let indexPath = IndexPath(row: 0, section: 0)
let cell = listVC.collectionView.cellForItem(at: indexPath)
return cell
})
let nav = UINavigationController()
nav.setViewControllers([listVC, detailVC], animated: false)
window?.rootViewController = nav
window?.makeKeyAndVisible()
This is meant to restore the UI state from a previous session — the app should launch directly into the DetailViewController.
The Problem
When I launch the app with setViewControllers([listVC, detailVC], animated: false), the transition from listVC to detailVC appears correctly (i.e., no animation, as intended), but the drag-to-dismiss gesture does not work. The back button appears, and tapping it correctly triggers the zoom-out transition back to the cell, so the preferredTransition = .zoom(...) itself is properly configured.
Interestingly, if I delay the push with a DispatchQueue.main.async and instead do:
nav.setViewControllers([listVC], animated: false)
DispatchQueue.main.async {
nav.pushViewController(detailVC, animated: true)
}
…then everything works perfectly — including the interactive swipe-to-dismiss gesture — but that introduces an unwanted visual artifact: the user briefly sees the listVC, and then it pushes to detailVC, which I’m trying to avoid.
My Question
Is there a way to enable the swipe-to-dismiss gesture when using setViewControllers([listVC, detailVC], animated: false)
It can be very confusing for users if swipe-to-dismiss only works in certain cases inconsistently.
Thanks
The documentation for UIListContentConfiguration states that I can get the default content configuration of a UICollectionViewCell by getting the cells default content configuration. In practice, however, this presents an error in the compiler:
let choiceRegistration = UICollectionView.CellRegistration<UICollectionViewCell, SurveyItem> { cell, indexPath, item in
cell.configurationUpdateHandler = { cell, state in
switch item.type {
case .choice(let letter, let text):
cell.defaultContentConfiguration()
...
}
The error shown when calling cell.defaultContentConfiguration() is Value of type 'UICollectionViewCell' has no member 'defaultContentConfiguration'. Instead, I need to initialise a content configuration using UIListContentConfiguration.cell() to get the default content configuration.
This needs to be reflected in the documentation in UIKit.
I my App I use the sheetPresentationController to get a sheet that sits on top of the main view (a Map) and that can be slided up and down, similar to the Maps or FindMy Apps.
This works great with iOS 18 and older. But under iOS 26 Beta I see issues, especially on the iPad.
When the window is small (iPhone or compact size class on iPad), changing the height of the sheet works as expected, the sheet window is attached to the bottom of the screen and I can slide it up and down. But when the App window is wider (regular size class on the iPad), the sheet is shown at the left (as expected), but it is no longer attached to the bottom of the screen, there's a very large (but constant) gap between the bottom of the App window and the bottom of the sheet. I haven't found a way to minimize the gap, the sheet window seems to totally ignore the vertical position and size of the "sourceView" to which the sheet should be attached to (it still evaluates the horizontal position, so I can move the sheet to the right, but the vertical position can't be controlled anymore). The Maps App or FindMy Apps do not show this issue, also iOS 18 and older do not show this issue.
Is this normal or can I do something to prevent this? The sheet should always be positioned to the bottom left corner of the App window,
Another problem is the window background with a UIGlassContainer effect. In the Apple Maps App the sheet looses its glass effect transparency under iOS 26 when the sheet is fully expanded. The FindMy does not have this issue, here the glass effect/transparency is always present. In my App the background shows the glass effect when the window is not fully expanded when the overall App window is above a certain height (like the Apple Maps App), but when the App window is below a certain height then it is the opposite way: fully expanded it shows the glass effect and at smaller heights it is opaque. Why is this the case?
How can I get the behavior of the FindMy App where the sheet window keeps its transparent glass effect in all cases? I do not want to have it changing its appearance depending of the height of the sheet.
I can "solve" some of the issues when presenting the "sheet" as popover (via popoverPresentationController) and from within the popoverPresentationController use the adaptiveSheetPresentationController property to get the UISheetPresentationController (instead of directly using the sheetPresentationController property). In small App windows (iPhone or compact size class) it works exactly as when directly using sheetPresentationController. With larger App windows (iPad and regular size class) the sheet will be attached to the bottom of the App window (as expected) and the glass effect is always present. However in this case the detents which define the allowed heights of the sheet window will be always ignored, the window seems to have always the maximum height (minus some safe areas), Even when using the preferredContentSize property to set the size, only the width is respected, but never the height.
Is there any way to get this working? Is this supposed to work this way or is this still a beta issue?
My app support ringout feature, when set Ringout, all the calls in my app will go to native, by using tel://xxx.
But when my app set as the default calling app by the user. Then when user make a call from Contact, it will jump to my app, but app will will route this call to native.
So there is a issue for this, then the quesion is:
How to check if my app is set as default calling app?
I'm using Swift to display some text in the middle of the screen, but I'm doing this programmatically instead of using the layout designer.
So I'm starting with my version of a UILabel:
class GenericLabel: UILabel
I'm then creating one of these objects:
let label = GenericLabel(frame: CGRect.zero)
label.processResponse(componentDictionary )
view.addSubview(label)
The processResponse function will set the text value, the font, fontsize, and set the bounds for where the text should be displayed on the screen. Currently I'm just wanting to position the text in the centre of the screen. During this process I send some messages to the console, like my calculation of the width and height and the bounds value. The console includes this:
GenericLabel: default = centrex and centrey
Utils:setSize: parent view bounds = (0.0, 0.0, 402.0, 874.0)
Utils:setSize: obj size = (85.33333333333333, 20.333333333333332)
Utils.setSize: centrey myframe.origin.y = 426.8333333333333
Utils.setSize: centrex myframe.origin.x = 158.33333333333334
Utils:setSize: myframe is now set to = (158.33333333333334, 426.8333333333333, 85.33333333333333, 20.333333333333332)
self.frame set to (158.33333333333334, 426.8333333333333, 85.33333333333333, 20.333333333333332)
Finally I set this frame to my GenericLabel
self.frame = Utils.setSize(["centrex":0, "centrey":0], for: self)
// You can see this message in the console above
print("self.frame set to \(self.frame)")
Unfortunately the text appears at (0,0) as in this screenshot.
Why is the frame not working?
Is there some setting overriding the frame?
Hi,
I’m seeing a crash when running my app on iOS 18 simulators or devices using Xcode 26 beta 3.
My app’s minimum deployment target is iOS 17, and the crash does not happen when running from Xcode 16.4.
The crash occurs specifically at this line:
return UIStoryboard(name: storyboard.rawValue, bundle: nil)
.instantiateViewController(withIdentifier: view.rawValue)
Crash Details:
** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named _TtGC5UIKit17UICoreHostingViewVCS_21ToolbarVisualProvider8RootView_ because no class named _TtGC5UIKit17UICoreHostingViewVCS_21ToolbarVisualProvider8RootView_ was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target)'
*** First throw call stack:
(0x191c3321c 0x18f0cdabc 0x191c91ea0 0x19d740774 0x19d740a18 0x19d740cac 0x194626680 0x194dbc784 0x19d740890 0x19d740cac 0x1949aadd8 0x19d740890 0x19d740a18 0x19d740cac 0x194802e24 0x1945f008c 0x194ed1808 0x107a8bfa0 0x107a8c05c 0x1945ec128 0x19d740890 0x19d740cac 0x1945eba60 0x19d740890 0x19d740a18 0x19d740cac 0x1945f07dc 0x1945eaea4 0x19492ee80 0x10763de00 0x1076e56fc 0x1076e5674 0x1076e5e04 0x19496108c 0x194f9b9a0 0x1949072c4 0x194f998cc 0x194f9af04 0x19445139c 0x19445ac28 0x194467508 0x1079afaec 0x1079aff5c 0x1944189a0 0x194417be4 0x1944114e4 0x194411404 0x194410ab4 0x19440c1e4 0x191b28a8c 0x191b288a4 0x191b28700 0x191b29080 0x191b2ac3c 0x1ded09454 0x19453d274 0x194508a28 0x1073564f4 0x1b89fff08)
terminating due to uncaught exception of type NSException
The crash occurs immediately at app launch, when attempting to load a storyboard-based UITabBarController.
Works as expected on:
Xcode 16.4 + iOS 18 (simulator/device)
Xcode 26 beta 3 + iOS 26 (simulator/device)
Running from Xcode 26 beta 3 onto iOS 18 simulators or devices and it immediate crash from the particular storyboard
Setup:
Xcode: 26 beta 3
macOS: 15.5
iOS Simulators: iOS 18.5
Minimum deployment target: iOS 17
UIKit-based app (not using SwiftUI)
No custom toolbars or host views in use explicitly
Is this a known compatibility issue when building with the iOS 26 SDK and running on iOS 18?
Are there any workarounds or recommendations for running apps targeting iOS 17+ on iOS 18 simulators when using Xcode 26?
I was trying to register a UICollectionReusableView in my UICollectionView.SupplementaryRegistration handler in order to apply a content configuration to apply the text and secondaryText properties to the reusable view. However, when I try to apply the content configuration on the header view object that I return in my cell registration handler, I get an error that says: "Value of type 'UICollectionReusableView' has no member 'contentConfiguration'".
How can apply content configuration to a UICollectionReusableView?
This is my code:
let headerRegistration = UICollectionView.SupplementaryRegistration<UICollectionReusableView>(elementKind: UICollectionView.elementKindSectionHeader) { header, elementKind, indexPath in
// Header configuration is handled in the header's init
var configuration = UIListContentConfiguration.plainHeader()
configuration.text = "Current Emotional State"
configuration.secondaryText = "What best describes how you're feeling right now?"
header.contentConfiguration = configuration
}
Topic:
UI Frameworks
SubTopic:
UIKit
In the Console, when presenting my view in a horizontally compact environment, I see:
UINavigationController for collapsing UISplitViewController about to push view controller <UINavigationController: 0x107933c00>
This message repeats infinitely, until the Xcode debugger eventually says:
QUARANTINED DUE TO HIGH LOGGING VOLUME
Of note is that this only occurs in the beta, does not occur when using the iOS 18.x SDK, and only occurs in a compact environment.
EDIT:
This occurs only when setting the secondary column of a doubleColumn UISplitViewController:
splitVC.setViewController(secondary, for: .secondary)
EDIT 2 and WORKAROUND:
If this action is deferred until after viewDidAppear, it self-resolves:
public override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
if let deferredSecondaryViewController {
splitVC.showDetailViewController(deferredSecondaryViewController, sender: nil)
}
}
Topic:
UI Frameworks
SubTopic:
UIKit
Starting on iOS 26 Beta 3, any UIVisualEffectView using a UIGlassEffect will have a default corner radius that cannot be modified by using UIVisualEffectView's layer.cornerRadius. This was working on Beta 1 and Beta 2.
On WWDC25 "Build a UIKit app with the new design", a UIVisualEffectView property called cornerConfiguration is used as example for changing the effect's corner radius, but this property does not seem to be available on any of the beta versions.
Is there any other way to update the UIGlassEffect corner radius on UIKit?
Hi,
In iOS 26, pushing or popping a view controller via UINavigationController shows a rounded corner effect during transition. This seems to be a new system feature.
Is there a way to disable this and restore the previous full-rectangle style, as seen in earlier iOS versions (e.g. iOS 18)? Any official API or recommended approach?
Thanks!
Hello Developer Forums Team,
I’ve seen that some banking apps prevent screenshots on certain sensitive screens. I’m working on a similar feature in my SDK and want to confirm if my implementation complies with App Store guidelines.
Since there’s no public API to block screenshots, I’m using a workaround based on the secure rendering behavior of UITextField (isSecureTextEntry = true). I embed my custom content (e.g., a UITableView) inside the internal secure container of a UITextField, which results in blank content being captured during screenshots—similar to what some banking apps do.
Approach Summary
I create a UITextField
I detect its internal secure container by matching UIKit internal class names as strings
I embed my real UI content into that container
I do not use or call any private APIs, just match view class names via strings.
ScreenshotPreventingView.swift
final class ScreenshotPreventingView: UIView {
private let textField = UITextField()
private let recognizer = HiddenContainerRecognizer()
private var contentView: UIView?
public var preventScreenCapture = true {
didSet {
textField.isSecureTextEntry = preventScreenCapture
}
}
public init(contentView: UIView? = nil) {
super.init(frame: .zero)
self.contentView = contentView
setupUI()
}
private func setupUI() {
guard let container = try? recognizer.getHiddenContainer(from: textField) else { return }
addSubview(container)
NSLayoutConstraint.activate([
container.topAnchor.constraint(equalTo: topAnchor),
container.bottomAnchor.constraint(equalTo: bottomAnchor),
container.leadingAnchor.constraint(equalTo: leadingAnchor),
container.trailingAnchor.constraint(equalTo: trailingAnchor)
])
if let contentView = contentView {
setup(contentView: contentView, in: container)
}
DispatchQueue.main.async {
self.preventScreenCapture = true
}
}
private func setup(contentView: UIView) {
self.contentView?.removeFromSuperview()
self.contentView = contentView
guard let container = hiddenContentContainer else { return }
container.addSubview(contentView)
container.isUserInteractionEnabled = isUserInteractionEnabled
contentView.translatesAutoresizingMaskIntoConstraints = false
let bottomConstraint = contentView.bottomAnchor.constraint(equalTo: container.bottomAnchor)
bottomConstraint.priority = .required - 1
NSLayoutConstraint.activate([
contentView.leadingAnchor.constraint(equalTo: container.leadingAnchor),
contentView.trailingAnchor.constraint(equalTo: container.trailingAnchor),
contentView.topAnchor.constraint(equalTo: container.topAnchor),
bottomConstraint
])
}
}
HiddenContainerRecognizer.swift
struct HiddenContainerRecognizer {
private enum Error: Swift.Error {
case unsupportedOSVersion(version: Float)
case desiredContainerNotFound(_ containerName: String)
}
func getHiddenContainer(from view: UIView) throws -> UIView {
let containerName = try getHiddenContainerTypeInStringRepresentation()
let containers = view.subviews.filter { subview in
type(of: subview).description() == containerName
}
guard let container = containers.first else {
throw Error.desiredContainerNotFound(containerName)
}
return container
}
private func getHiddenContainerTypeInStringRepresentation() throws -> String {
if #available(iOS 15, *) {
return "_UITextLayoutCanvasView"
}
if #available(iOS 14, *) {
return "_UITextFieldCanvasView"
}
if #available(iOS 13, *) {
return "_UITextFieldCanvasView"
}
if #available(iOS 12, *) {
return "_UITextFieldContentView"
}
let currentIOSVersion = (UIDevice.current.systemVersion as NSString).floatValue
throw Error.unsupportedOSVersion(version: currentIOSVersion)
}
}
How I use it in my Screen
let container = ScreenshotPreventingView()
override func viewDidLoad() {
super.viewDidLoad()
container.preventScreenCapture = true
container.setup(contentView: viewContainer) //viewContainer is UIView in storyboard, in which all other UI elements are placed in e.g. UITableView
self.view.addSubview(container)
container.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
container.topAnchor.constraint(equalTo: self.view.topAnchor),
container.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
container.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
container.trailingAnchor.constraint(equalTo: self.view.trailingAnchor)
])
}
What I’d Like to Confirm
Is this approach acceptable for App Store submission?
Is there a more Apple-recommended approach to prevent screen capture of arbitrary UI?
Thank you for your help in ensuring compliance.
Hi Apple Developer Team,
I'm encountering a regression in iOS 18 related to the Picture-in-Picture (PiP) feature when using custom views.
In previous versions of iOS (up to iOS 17), it's possible to show a custom UIView inside the PiP window — for example, a UILabel, UITableView, or other standard UI elements. This works well even when switching between apps.
However, in iOS 18 (tested on the developer beta), there's an issue:
If App A starts PiP mode and displays a custom view, and then the user switches to App B and starts a video call (e.g., using FaceTime or another VoIP app), all the custom views in the PiP window suddenly disappear. The PiP window itself remains, but its contents are empty. This behavior did not occur in earlier iOS versions.
Steps to reproduce:
In App A, start Picture-in-Picture with a custom UIView added to the PiP window.
Switch to App B and initiate a video call (e.g., FaceTime).
Observe the PiP window — the custom view is no longer visible.
This issue breaks UI functionality that previously worked and may impact apps that rely on interactive or dynamic content in PiP.
Is this a known issue in iOS 18, or is this behavior change intentional? Any suggested workarounds or updates?
Thanks in advance for your support.
When using UIPageViewController inside a UITabBarController on iOS 26 with Liquid Glass adoption, visiting the PageViewController tab applies a blur effect to the navigation bar and tab bar even though the current child view controller of the pageView is not scrollable and does not reach behind these bars.
Questions:
Is this the expected behavior that the pageview's internal scroll view causes the bars to blur regardless of the page view's child content’s scrollability?
If so, is there an official way to make the blur effect appear only when the pageview's current child view controller actually scrolls behind the navigation bar or tab bar, and not in static cases?
Tried the same in SwiftUI using TabView and TabView with page style. Facing the same issue there as well.
Sample screenshots for reference,
Sample SwiftUI code,
struct TabContentView: View {
var body: some View {
TabView {
// First Tab: Paging View
PagingView()
.tabItem {
Label("Pages", systemImage: "square.fill.on.square.fill")
}
// Second Tab: Normal View
NavigationStack {
ListView()
}
.tabItem {
Label("Second", systemImage: "star.fill")
}
// Third Tab: Normal View
PageView(color: .blue, text: "Page 3")
.tabItem {
Label("Third", systemImage: "gearshape.fill")
}
}
.ignoresSafeArea()
}
}
struct PagingView: View {
var body: some View {
TabView {
PageView(color: .red, text: "Page 1")
PageView(color: .green, text: "Page 2")
PageView(color: .blue, text: "Page 3")
}
.tabViewStyle(.page) // Enables swipe paging
.indexViewStyle(.page(backgroundDisplayMode: .always))
.ignoresSafeArea()// Dots indicator
}
}
In WWDC25 video 284: Build a UIKit app with the new design, there is mention of a cornerConfiguration property on UIVisualEffectView. But this properly isn't documented and Xcode 26 isn't aware of any such property.
I'm trying to replicate the results of that video in the section titled Custom Elements starting at the 19:15 point. There is a lot of missing details and typos in the code associated with that video.
My attempts with UIGlassEffect and UIViewEffectView do not result in any capsule shapes. I just get rectangles with no rounded corners at all.
As an experiment, I am trying to recreate the capsule with the layers/location buttons in the iOS 26 version of the Maps app.
I put the following code in a view controller's viewDidLoad method
let imgCfgLayer = UIImage.SymbolConfiguration(hierarchicalColor: .systemGray)
let imgLayer = UIImage(systemName: "square.2.layers.3d.fill", withConfiguration: imgCfgLayer)
var cfgLayer = UIButton.Configuration.plain()
cfgLayer.image = imgLayer
let btnLayer = UIButton(configuration: cfgLayer, primaryAction: UIAction(handler: { _ in
print("layer")
}))
var cfgLoc = UIButton.Configuration.plain()
let imgLoc = UIImage(systemName: "location")
cfgLoc.image = imgLoc
let btnLoc = UIButton(configuration: cfgLoc, primaryAction: UIAction(handler: { _ in
print("location")
}))
let bgEffect = UIGlassEffect()
bgEffect.isInteractive = true
let bg = UIVisualEffectView(effect: bgEffect)
bg.contentView.addSubview(btnLayer)
bg.contentView.addSubview(btnLoc)
view.addSubview(bg)
btnLayer.translatesAutoresizingMaskIntoConstraints = false
btnLoc.translatesAutoresizingMaskIntoConstraints = false
bg.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
btnLayer.leadingAnchor.constraint(equalTo: bg.contentView.leadingAnchor),
btnLayer.trailingAnchor.constraint(equalTo: bg.contentView.trailingAnchor),
btnLayer.topAnchor.constraint(equalTo: bg.contentView.topAnchor),
btnLoc.centerXAnchor.constraint(equalTo: bg.contentView.centerXAnchor),
btnLoc.topAnchor.constraint(equalTo: btnLayer.bottomAnchor, constant: 15),
btnLoc.bottomAnchor.constraint(equalTo: bg.contentView.bottomAnchor),
bg.centerXAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerXAnchor),
bg.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 40),
])
The result is pretty close other than the complete lack of capsule shape.
What changes would be needed to get the capsule shape? Is this even the proper approach?
In beta 2 using layer.cornerRadius on a UIEffectView with the UIGlassEffect allowed you to change the corner radius of the view. In beta 3, this no longer works. WWDC videos indicate the right way to do this is to set the cornerConfiguration on the UIEffectView, but that API doesn't seem to be available yet. At this time it doesn't seem like theres a way to have a glass view that isn't pill shaped.
I have installed the iOS 26 Beta on my device and conducted a comprehensive functionality test of my iOS application, which I designed and developed. The application includes a feature that allows users to share images directly to X (formerly Twitter) and Facebook.
During testing, I encountered an issue where the icons for X (formerly Twitter) and Facebook do not appear in the share dialog, despite both apps being installed on the device. This issue prevents users from sharing images to these platforms directly from the app.
Steps to Reproduce:
1.Install iOS 26 Beta on a compatible device.
2.Ensure that both the X (formerly Twitter) and Facebook apps are installed and logged in on the device.
3.Open the iOS application and navigate to the image sharing feature.
4.Attempt to share an image using the share dialog.
5.Observe that the icons for X (formerly Twitter) and Facebook are missing from the share options.
Expected Behavior:
The share dialog should display icons for X (formerly Twitter) and Facebook, allowing users to share images directly to these platforms.
Actual Behavior:
The icons for X (formerly Twitter) and Facebook do not appear in the share dialog, preventing direct sharing to these platforms.
Code Implementation:
I have not implemented any code to exclude X (formerly Twitter) and Facebook from the share options. Below is the relevant code for controlling the share screen:
let activityViewController = UIActivityViewController(activityItems: activityItems, applicationActivities: applicationActivities)
let excludedTypes = [
UIActivity.ActivityType.assignToContact,
UIActivity.ActivityType.print,
]
activityViewController.excludedActivityTypes = excludedTypes
activityViewController.completionWithItemsHandler = completion
self.present(activityViewController, animated: true, completion: nil)
As shown in the implementation, there is no exclusion of X (formerly Twitter) and Facebook, yet their icons do not appear in the share dialog.