Construct and manage graphical, event-driven user interfaces for iOS or tvOS apps using UIKit.

UIKit Documentation

Posts under UIKit tag

1,044 Posts
Sort by:
Post marked as solved
4 Replies
54 Views
Hi, I have a UITextView with allowsEditingTextAttributes set to true. On iOS 15 and before, users can select part of the text and tap on the BIU button in order to set the text to bold, italic or underline. On iOS 16 the BIU button is missing. How can the user change the formatting of the text contained inside an UITextView on iOS 16? There is something I need to specify on UITextView? Thank you
Posted
by DaleOne.
Last updated
.
Post not yet marked as solved
1 Replies
37 Views
After programmatically changing the selection of a UITableview, focus gets separated from the selection if I programmatically select a cell beyond the visible region of the table view. That is to say the focused cell is not the selected cell which any user would consider wrong. To reproduce Add a button to select the "Next" row in a table (deselect the previous selected row, then select the next row just below it) Click the button. Keep clicking the button to move the table view selection down. Once you select the row outside the visible region of the table view focus cell gets separated from the selection. I created a bug report on this with a sample project: FB11803433 Trying to scroll the row visible before programmatically changing the selection doesn't always work around the issue. I experimented with -performSelector:withObject:afterDelay: calls and -setNeedsFocusUpdate and -updateFocusIfNeeded calls but it doesn't always seem to work.
Posted Last updated
.
Post not yet marked as solved
0 Replies
31 Views
Hi, So I am currently trying to create an app and for one of its functions I want to text the user from let's say my number or call the user from my number after they enter their number in the textfields. So, the idea is to send a text message or make a call to the user from the app after they press a button. How can I achieve that? P.S: I do not want to use any third-party app but if there are any libraries that can do this then please let me know. I used MFMailComposer that pops up the imessage app and then asks the users to send the text. I don't want that. Instead, I want to send a text to the user. For a clearer explanation you can imagine this as sending an OTP to the user after they provide their phone number. I will be sending them a reminder sort of text not an OTP in this case.
Posted
by rifah.
Last updated
.
Post not yet marked as solved
0 Replies
54 Views
I am trying to use NSFetchedResultsController and its delegate methods with UITableViewDiffableDataSource, and I've encountered a problem with applying a snapshot of updated data. When new entities are added or deleted everything works fine, but when an entity gets modified the snapshot doesn't update the associated row. Is there any way of resolving this unobvious behaviour?
Posted Last updated
.
Post not yet marked as solved
6 Replies
5.8k Views
I tryed to play videos on WKWebView after the following codes.1. Set AVAudioSessionCategory to SoloAmbientdo { try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategorySoloAmbient) } catch let error as NSError { print(error) }Error was not print.2. Called setActive(true)do { try AVAudioSession.sharedInstance().setActive(true) } catch let error as NSError { print(error) }Error was not print.3. Checked current AVAudioSessionCategoryprint("audioSession.category = \(AVAudioSession.sharedInstance().category)")Output:audioSession.category = AVAudioSessionCategorySoloAmbientBut, WKWebView ignores status of Ring/Silent switch, outputs video sound even if state of the switch is Silent.I thought that this behavior is like AVAudioSessionCategoryPlayback.UIWebView does not ignore.Is there a solution?I use devices below.iPhone 5s : iOS 8.4.1iPhone 6 plus : iOS 9.
Posted
by 131e55.
Last updated
.
Post not yet marked as solved
0 Replies
47 Views
Hi, We've created and published an application for iOS. We use Firebase Crashlytics and get some crashs related to Foundation. This happened on iPhone 11 Pro/ iOS 16.0.0. I've add the crash log below. Please check it and give me some hint. Thank you so much. Crash Log
Posted Last updated
.
Post not yet marked as solved
0 Replies
56 Views
Hi, We created and published an application for iOS and use Firebase Crashlytics to grab the crashes. We get some crashes related to UIKitCore. This happened on iPhone 14 Pro/ iOS 16.1.0 I've added the crash log below. Please check and help me. Thank you so much. Crash Log
Posted Last updated
.
Post not yet marked as solved
0 Replies
66 Views
I have implemented CollectionView Drag and Drop Delegate into my project to achieve the drag and drop feature on two collection views but my client needed smoother drag and it seems that CollectionView Drag and Drop delegate only supports long press recognizer. How to add PanGestureRecognizer to activate the drag and drop between multiple collection view cells.
Posted Last updated
.
Post not yet marked as solved
0 Replies
74 Views
Hello, I've noticed in the latest iOS releases >= 15.6.1, including iOS 16.0, a problem with the UIActivityViewController when opened on an app which language is set to Arabic. The whole content is mirrored, the share option captions characters are inverted making them unreadable. It is enough to put the app in background and reopen or rotate the device to get the view properly rendered. The issue is not present on iOS 15.0. Is anyone aware of this issue? Is there a known fix for this? Thank you
Posted
by tecnavia.
Last updated
.
Post not yet marked as solved
6 Replies
12k Views
With the following code I get the warning below it: let rootController = UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController 'windows' was deprecated in iOS 15.0: Use UIWindowScene.windows on a relevant window scene instead How do I change the code above to work with UIWindowScene instead?
Posted Last updated
.
Post not yet marked as solved
1 Replies
100 Views
I used Snapkit to automatically layout three input boxes and a button. They are arranged vertically. I want to display only the first and second input boxes and buttons at the beginning. In special cases, the third input box needs to be displayed. The problem I have now is that I use isHidden to hide the third input box, but it also occupies the height of the screen, resulting in a blank space in the middle. What should I do imagecodeTextField = UITextField()     imagecodeTextField.leftView = imageCodeLeftImgView     imagecodeTextField.leftViewMode = .always     imagecodeTextField.rightView = imageCodeImage     imagecodeTextField.rightViewMode = .always     imagecodeTextField.backgroundColor = UIColor(red: 245/255.0, green: 245/255.0, blue: 245/255.0, alpha: 1.0)     imagecodeTextField.layer.cornerRadius = 5     imagecodeTextField.layer.masksToBounds = true     imagecodeTextField.placeholder = "hint_please_input_verify_code".localized()     view.addSubview(imagecodeTextField)     imagecodeTextField.snp.makeConstraints { make in       make.left.equalToSuperview().offset(20)       make.right.equalToSuperview().offset(-20)       make.top.equalTo(passTextField.snp_bottom).offset(15)       make.height.equalTo(50)     }     //Hide Input Box     imagecodeTextField.isHidden = true     loginButton = UIButton(type: .custom)     loginButton.setTitle("signin".localized(), for: .normal)     loginButton.setTitleColor(.white, for: .normal)     loginButton.titleLabel?.font = UIFont.systemFont(ofSize: 30)     loginButton.backgroundColor = UIColor(red: 105/255.0, green: 175/255.0, blue: 241/255.0, alpha: 1.0)     loginButton.layer.cornerRadius = 10     loginButton.layer.masksToBounds = true     view.addSubview(loginButton)     loginButton.addTarget(self, action: #selector(login(_:)), for: .touchUpInside)     loginButton.snp.makeConstraints { make in       make.left.equalToSuperview().offset(20)       make.right.equalToSuperview().offset(-20)       make.top.equalTo(imagecodeTextField.snp.bottom).offset(20)       make.height.equalTo(50)     }
Posted
by sqsdhc.
Last updated
.
Post marked as solved
1 Replies
85 Views
I've encountered with this explanation of viewDidLoad method: _ "This is called only once after creating the view and loading it into memory. But the bounds of the view are not defined yet. We generally override this method to initialize the objects which the view controller will use. We shouldn’t forget to call super when we override." _ I decided to check this, and the only time I didn't get the final bounds of a root view is when overrided loadView method and swapped the root view with custom view without specifying its frame. And the size of the subviews of the root view are only available after viewDidLayoutSubviews if I'm not mistaken.
Posted Last updated
.
Post marked as solved
3 Replies
106 Views
So I have a stack view and the profile image needs to go next to the the username and stay there. How do I do that in this arranged stack view without conflicts because I have tried to anchor it to the top. Like this but no results: But I am actually getting: Here is the code for the stack view:     override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {         super.init(style: style, reuseIdentifier: reuseIdentifier)         contentView.addSubview(profileImageView)         contentView.addSubview(profileNameLabel)         contentView.addSubview(userHandel)                                    profileImageView.setContentHuggingPriority(.defaultHigh, for: .horizontal)                                                               let innerPostStackView = UIStackView(arrangedSubviews: [profileNameLabel, userHandel, postTextLabel])         innerPostStackView.axis = .vertical                       let postStackView = UIStackView(arrangedSubviews: [profileImageView, innerPostStackView])         postStackView.translatesAutoresizingMaskIntoConstraints =  false         postStackView.alignment =  .center         postStackView.spacing = 10         contentView.addSubview(postStackView)                           NSLayoutConstraint.activate([                          postStackView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 10),             postStackView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -15),             postStackView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 10),             postTextLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -15)                                         ]) Hope someone can help.
Posted
by MrIrazak.
Last updated
.
Post not yet marked as solved
2 Replies
1.2k Views
An app which was running successfully on iOS9-15 now crashes on launch on iOS9-12 when building with XCode13.1 (on M1 Pro). It crashes on unarchive of the main storyboard due to use of UITabBarAppearance which only exists on iOS13+ (see trace below). I have not edited my storyboard file since this was working on iOS 9-15 with previous XCode versions and the crash occurs before any of my code runs. In the hope it was a simulator-only issue (I have no old-iOS devices) I uploaded to the store but the app crashes on launch on real devices. https://apps.apple.com/nz/app/campermate-australia-nz/id1586561660 We could drop support for iOS9-11 but we still have plenty of iPhone 6 and 5 users (limited to iOS12). How can I fix this? 2021-12-15 10:51:09.954515+1300 TTG_Explore_Australia[36783:2248622] *** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named UITabBarAppearance because no class named UITabBarAppearance 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: ( 0  CoreFoundation           0x0000000113cae8db __exceptionPreprocess + 331 1  libobjc.A.dylib           0x0000000113259ac5 objc_exception_throw + 48 2  CoreFoundation           0x0000000113cae735 +[NSException raise:format:] + 197 3  UIFoundation            0x00000001176626c9 UINibDecoderDecodeObjectForValue + 360 4  UIFoundation            0x0000000117662af9 UINibDecoderDecodeObjectForValue + 1432 5  UIFoundation            0x0000000117662554 -[UINibDecoder decodeObjectForKey:] + 251 6  UIKitCore              0x000000011ca0c827 -[UINib instantiateWithOwner:options:] + 1306 7  UIKitCore              0x000000011cf28594 -[UIStoryboard instantiateViewControllerWithIdentifier:] + 181 8  UIKitCore              0x000000011cd8c809 -[UIApplication _loadMainStoryboardFileNamed:bundle:] + 111 9  UIKitCore              0x000000011cd8ccb1 -[UIApplication _loadMainInterfaceFile] + 274 10 UIKitCore              0x000000011cd8b3e5 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1360 11 UIKitCore              0x000000011c5cfa4e __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 904 12 UIKitCore              0x000000011c5d8346 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153 13 UIKitCore              0x000000011c5cf664 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236 14 UIKitCore              0x000000011c5cffc0 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1091 15 UIKitCore              0x000000011c5ce332 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 782 16 UIKitCore              0x000000011c5cdfe9 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433 17 UIKitCore              0x000000011c5d2d2e __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 576 18 UIKitCore              0x000000011c5d3988 _performActionsWithDelayForTransitionContext + 100 19 UIKitCore              0x000000011c5d2a95 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223 20 UIKitCore              0x000000011c5d7a48 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392 21 UIKitCore              0x000000011cd89dc8 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 514 22 UIKitCore              0x000000011c94102f -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361 23 FrontBoardServices         0x000000011aeb4d25 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448 24 FrontBoardServices         0x000000011aebead6 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 283 25 FrontBoardServices         0x000000011aebe300 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53 26 libdispatch.dylib          0x0000000114cc4db5 _dispatch_client_callout + 8 27 libdispatch.dylib          0x0000000114cc82ba _dispatch_block_invoke_direct + 300 28 FrontBoardServices         0x000000011aef00da __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30 29 FrontBoardServices         0x000000011aeefd92 -[FBSSerialQueue _performNext] + 451 30 FrontBoardServices         0x000000011aef0327 -[FBSSerialQueue _performNextFromRunLoopSource] + 42 31 CoreFoundation           0x0000000113c15db1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 32 CoreFoundation           0x0000000113c15633 __CFRunLoopDoSources0 + 243 33 CoreFoundation           0x0000000113c0fcef __CFRunLoopRun + 1231 34 CoreFoundation           0x0000000113c0f4d2 CFRunLoopRunSpecific + 626 35 GraphicsServices          0x00000001169e62fe GSEventRunModal + 65 36 UIKitCore              0x000000011cd8cfc2 UIApplicationMain + 140 37 TTG_Explore_Australia        0x0000000100e63dd8 main + 104 38 ???                 0x0000000202b024fe 0x0 + 8635032830 39 ???                 0x0000000000000003 0x0 + 3 ) libc++abi.dylib: terminating with uncaught exception of type NSException *** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named UITabBarAppearance because no class named UITabBarAppearance 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)' terminating with uncaught exception of type NSException CoreSimulator 776.4 - Device: iPhone 8 Plus (B0A6FB7E-392D-40E7-AC7C-B6AF109ABE60) - Runtime: iOS 12.4 (16G73) - DeviceType: iPhone 8 Plus
Posted Last updated
.
Post not yet marked as solved
1 Replies
138 Views
My app keeps getting rejected because of Guideline 2.1 - Performance - App Completeness I got a crash report from judge. I think my storyboard make some issue for this. but I can't solve this problen a few week.. Only thing that I can guess is BaseCollectionViewCell in line 39 But that file doesn't have any special role. It just print log when deinit. Let me know any idea about below problem if you know. Thanks Exception Codes: 0x0000000000000000, 0x0000000000000000 Triggered by Thread: 0 Application Specific Information: abort() called Last Exception Backtrace: 0 CoreFoundation 0x195659e88 __exceptionPreprocess + 164 1 libobjc.A.dylib 0x18ea078d8 objc_exception_throw + 60 2 UIKitCore 0x197c1d16c -[UIStoryboard initWithBundle:storyboardFileName:identifierToNibNameMap:identifierToExternalStoryboardReferenceMap:designatedEntryPointIdentifier:designatedMenuIdentifier:] + 0 3 UIKitCore 0x197ab3590 -[UIApplication _loadMainStoryboardFileNamed:bundle:] + 80 4 UIKitCore 0x197beef24 -[UIApplication _loadMainInterfaceFile] + 156 5 UIKitCore 0x197b65ee0 -[UIApplication _runWithMainScene:transitionContext:completion:] + 688 6 UIKitCore 0x197b65bd4 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 132 7 UIKitCore 0x1978ab600 _UIScenePerformActionsWithLifecycleActionMask + 108 8 UIKitCore 0x197bed918 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 216 9 UIKitCore 0x197a9dfa4 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 220 10 UIKitCore 0x197a9ddcc -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 620 11 UIKitCore 0x197a9d97c -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 252 12 UIKitCore 0x197a9d848 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 148 13 UIKitCore 0x19817ffa8 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:fromCurrentState:actions:completion:] + 736 14 UIKitCore 0x198218f98 _UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion + 224 15 UIKitCore 0x197949958 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 316 16 UIKitCore 0x197dbc7a8 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.214 + 556 17 UIKitCore 0x197a1c0b8 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 216 18 UIKitCore 0x197a1bf28 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 244 19 UIKitCore 0x197a1b47c -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 520 20 UIKitCore 0x197a1b208 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 288 21 FrontBoardServices 0x1ab269500 -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 344 22 FrontBoardServices 0x1ab2a851c __92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke.78 + 120 23 FrontBoardServices 0x1ab26d294 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 168 24 FrontBoardServices 0x1ab2a8154 __92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke + 360 25 libdispatch.dylib 0x19cc25fdc _dispatch_client_callout + 20 26 libdispatch.dylib 0x19cc29a5c _dispatch_block_invoke_direct + 264 27 FrontBoardServices 0x1ab2773b0 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 52 28 FrontBoardServices 0x1ab276f4c -[FBSSerialQueue _targetQueue_performNextIfPossible] + 220 29 FrontBoardServices 0x1ab27972c -[FBSSerialQueue _performNextFromRunLoopSource] + 28 30 CoreFoundation 0x195725f54 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 31 CoreFoundation 0x19573232c __CFRunLoopDoSource0 + 176 32 CoreFoundation 0x1956b6210 __CFRunLoopDoSources0 + 244 33 CoreFoundation 0x1956cbba8 __CFRunLoopRun + 836 34 CoreFoundation 0x1956d0ed4 CFRunLoopRunSpecific + 612 35 GraphicsServices 0x1ce12d368 GSEventRunModal + 164 36 UIKitCore 0x197baf3d0 -[UIApplication _run] + 888 37 UIKitCore 0x197baf034 UIApplicationMain + 340 38 libswiftUIKit.dylib 0x19e19b308 UIApplicationMain(_:_:_:_:) + 104 39 MyApp 0x102aab394 main + 29588 (BaseCollectionViewCell.swift:0) 40 dyld 0x1b3d28960 start + 2528
Posted
by hongDev.
Last updated
.
Post not yet marked as solved
1 Replies
75 Views
I have a Document based app that I’ve managed to adapt the Document Browser VC and Document View VC’s to most of its needs. The UX could be better though, if some further customization of the Document Browser were possible. I’m listing here the features I would like to see, partly to draw attention to how, I believe the Document Browser could be improved and partly because I may be missing some features that are already present in the Document Browser, that I haven’t figured out how to use. The following items are in the order of what I believe would be the easiest to the hardest features for Apple to imlement, if they’re not there already. 1/ The Open menu command. A Document or Documents cannot be opened in the Document view VC unless they have been previously selected in the Document Browser. First of all, I would like to be able to change the name of this command to something more appropriate to the kind of app and documents being developed, For example, instead of “Open” it might be more approiate for an app to name it “Edit”. 2/ Selection of Documents in the Document Browser. When a folder has been opened in the Document Browser I would like to be able to programatically pre-select items in that folder for the user. So the user doesn’t have to do this manually.  Of course this would be limited to the document types supported by my app and could be further filtered within my code. In some cases I may want to programatically select all documents in a folder as soon as the folder is opened. In other cases only specific documents may be pre-selected. I may also want the “Open” command above to be automatically invoked as soon as a folder is opened in the Document Browser. So these files would be automatically selected by the user and the opened in the Document view, with just a single tap on the folder which contains those documents. Related to this is the fact that the “Open” command currently does nothing, unless at least one Document is selected. Perhaps it should only be available when documents have been selected and “greyed out” otherwise. This would send a clear message to the user that docucuments must be selected before “Open” can be invoked. 3/ Upload a document to a location outside of my App’s Sandbox. This is currently possible; but is very convoluted. In the case of my app a document is automatically fetched from the internet and presented to the user in the Document view VC. I would like the user to have the option of long pressing on this document and request it to be uploaded to the same location as the rest of the Documents which are already in that location and presented in the Document viewer. Obviously the user would be giving permission for this via an alert and could choose to cancel instead of proceeding. Right now, I’m automatically downloading these document to my app’s Documents folder. So the user has to navigate there via the Document Browser, select the Downloaded document, choose “Move” then navigate back to the location where they want the document to be uploaded and choose “Copy” when they get there. This is a long process and forces the user to navigate away from the Document viewer, when I beloeve this shoudl be prossible with one long press and followed by confirmation in the alert. 4/ Make Documents URLs within a folder available before the folder is opened. This is a little bit simiar to “2” above. It seems that urls only become available for my app to work with, when they have been selected by the user from within an opened folder. I would like all the urls, which are contained in a folder, to be available to my app, if the user chooses “Select” and selects that folder. Right now, if a user chooses the “Select” command before tapping on a folder, taps on the folder, then chooses the “Open” command, they are taken to an empty document in the Document viewer VC. I believe this is because, from the point of view of a Docuement based app, the user has chosen to view a Document of type directory. When, of course, what the user would really want is to see all the documents contained within that folder presented in the Document view. At least that’s the case for my app. Further, if the user selects multiple folders and chooses “Open” all the documents contained in all of the selected folder would be presented in the Document view. My app, obviously decides how they are presented, in what order; etc. 5/ Cause folder icons to be replaced by a thumbnail of an image contained within each folder When subfolders contain an image document, which is representative of the documents handled by my app, I would like that image to replace the generic folder icons for those folders. I realize this may be a tall order, because when the user navigates to a bunch of subfolders, which contain an image file, the Document browser would need to programatically look ahead, into the contents of each folder, and if it contains an image file, present a thumbnail of that image in place of the generic folder icon. 6/ Allow customisation of Document Browser’s menus The Document Browser VC is very full featured. Some of those features though, are just not appropriate to my app. So I would like to be able to customize the menus, and be able to remove any commands that I feel could cause the user to lose focus on what they want to accomlish with my app. For example, in my case, I only want to list the contents of a folder by name and I don’t need any of the “View Options” and the user doesn’t need to be able to create a new folder. This would allow more space for me to add the few additional menu items that apply to my app and would avoid clutter. I realize this is really a list of feature requests for the Document Browser. Some of these may have been requested before and apologies if I missed those. If this isn’t the appropriate place to post these requests, then I’ll be grateful if someone can point me in the right direction, …and again, if any of these are already possible somehow, I’ll be very gratful for any advice on how to accomplished them. Thanks for listening.
Posted
by soundgals.
Last updated
.
Post not yet marked as solved
1 Replies
950 Views
I have been struggling to get a functional UISearchController in a SwiftUI app, under a tab bar. I've scoured the web and documentation, and managed to get something almost there, however the keyboard on the search view does not respond to left and right controls. I've seen a post on StackExchange where someone has a similar issue, but no solution. Can anyone help to show how to make a functional search view in a SwiftUI app on tvOS 13 ? One thing to note, while working through the views, I discovered a bug in USearchView which doesn't set a horizontal constraint for the keyboard area in one of its' inner views. I include a fix for that which adds in the constraint if one can't be found. I've attached the full source, just add to an empty tvOS SwiftUI project (and remove AppDelegate and ContentView) TestSearch.swift - https://developer.apple.com/forums/content/attachment/af387dcd-4501-44b3-90ac-f71177634103 The UISearchView HostingView: struct PageView<Page: View>: View {     var viewController: UIHostingController<Page>     @ObservedObject var state: SearchState     init(_ resultsView: Page, state: SearchState) {         self.viewController = UIHostingController(rootView: resultsView)         self.state = state     }     var body: some View {         PageViewController(controller: viewController, state: state)     } } struct PageViewController: UIViewControllerRepresentable {     var controller: UIViewController     @ObservedObject var state: SearchState     func makeUIViewController(context: Context) -> UINavigationController {         let searchController = UISearchController(searchResultsController: controller)         searchController.searchResultsUpdater = state         searchController.searchBar.placeholder = NSLocalizedString("Enter search (e.g. Shawshank)", comment: "")         let searchContainer = UISearchContainerViewController(searchController: searchController)         searchContainer.title = NSLocalizedString("Search", comment: "")         let searchNavigationController = UINavigationController(rootViewController: searchContainer)         return searchNavigationController     }     func updateUIViewController(_ searchContainer: UINavigationController, context: Context) {         if searchContainer.children.count > 0,             let searchController = (searchContainer.children[0] as? UISearchContainerViewController)?.searchController,             let searchControllerView = searchController.view,             searchController.children.count > 1,             let uiKBFocusView = searchController.children[1].view,             !searchControllerView.constraints.reduce(false, {$0 || ($1.firstAttribute == NSLayoutConstraint.Attribute.centerX) }){             let horizontalConstraint = NSLayoutConstraint(item: uiKBFocusView, attribute: NSLayoutConstraint.Attribute.centerX, relatedBy: NSLayoutConstraint.Relation.equal, toItem: searchControllerView, attribute: NSLayoutConstraint.Attribute.centerX, multiplier: 1, constant: 0) searchControllerView.addConstraints([horizontalConstraint])         }     } } The Search State and results view class SearchState: NSObject, ObservableObject, UISearchResultsUpdating {     @Published var text: String = ""          func updateSearchResults(for searchController: UISearchController) {         let searchBar = searchController.searchBar         self.text = searchBar.text ?? ""     } }
Posted
by geebeedev.
Last updated
.
Post not yet marked as solved
0 Replies
128 Views
I have received the following crash log from Firebase Crashlytics but could not identify the exact reason. It's happing on iOS devices having os version above 15.0. Crashed: com.apple.main-thread 0 libswiftCore.dylib 0x3da990 swift_getObjectType + 40 1 libswiftUIKit.dylib 0x9674 thunk for @escaping @callee_guaranteed (@guaranteed UITableView, @in_guaranteed IndexPath, @in_guaranteed Any) -> (@owned UITableViewCell?) + 192 2 UIKitCore 0x3e81c -[__UIDiffableDataSource collectionView:cellForItemAtIndexPath:] + 188 3 libswiftUIKit.dylib 0x2dc8 UICollectionViewDiffableDataSource.collectionView(_:cellForItemAt:) + 80 4 libswiftUIKit.dylib 0x2c0c @objc UICollectionViewDiffableDataSource.collectionView(_:cellForItemAt:) + 224 5 UIKitCore 0x32b0f4 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:] + 1148 6 UIKitCore 0x2255f0 -[UICollectionView _updateVisibleCellsNow:] + 4372 7 UIKitCore 0x179c4c -[UICollectionView layoutSubviews] + 320 8 UIKitCore 0x18c17c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2592 9 QuartzCore 0x407fc CA::Layer::layout_if_needed(CA::Transaction*) + 532 10 QuartzCore 0x32c60 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 136 11 QuartzCore 0x475b4 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 452 12 QuartzCore 0x504a8 CA::Transaction::commit() + 704 13 UIKitCore 0x165b2c _afterCACommitHandler + 88 14 CoreFoundation 0x410c4 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36 15 CoreFoundation 0x10080 __CFRunLoopDoObservers + 592 16 CoreFoundation 0xb13c __CFRunLoopRun + 1052 17 CoreFoundation 0x1ebc8 CFRunLoopRunSpecific + 600 18 GraphicsServices 0x1374 GSEventRunModal + 164 19 UIKitCore 0x514b58 -[UIApplication _run] + 1100 20 UIKitCore 0x296090 UIApplicationMain + 364 21 libswiftUIKit.dylib 0x30ecc UIApplicationMain(_:_:_:_:) + 104 22 Adastria 0xd640 main + 4295185984 (TagListView.swift:4295185984) 23 ??? 0x10513dda4 (Missing) Thread 0 libsystem_kernel.dylib 0x1a74 __workq_kernreturn + 8 1 libsystem_pthread.dylib 0x1108 _pthread_wqthread + 364 2 libsystem_pthread.dylib 0xe5c start_wqthread + 8 com.apple.uikit.eventfetch-thread 0 libsystem_kernel.dylib 0x14a0 mach_msg_trap + 8 1 libsystem_kernel.dylib 0x1ae4 mach_msg + 76 2 CoreFoundation 0x6d30 __CFRunLoopServiceMachPort + 372 3 CoreFoundation 0xb1bc __CFRunLoopRun + 1180 4 CoreFoundation 0x1ebc8 CFRunLoopRunSpecific + 600 5 Foundation 0x19444 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 236 6 Foundation 0x5ae0c -[NSRunLoop(NSRunLoop) runUntilDate:] + 92 7 UIKitCore 0x48ecc4 -[UIEventFetcher threadMain] + 524 8 Foundation 0x6941c __NSThread__start__ + 808 9 libsystem_pthread.dylib 0x19ac _pthread_start + 148 10 libsystem_pthread.dylib 0xe68 thread_start + 8 Thread 0 libsystem_kernel.dylib 0x1a74 __workq_kernreturn + 8 1 libsystem_pthread.dylib 0x1108 _pthread_wqthread + 364 2 libsystem_pthread.dylib 0xe5c start_wqthread + 8 com.google.firebase.crashlytics.MachExceptionServer 0 FirebaseCrashlytics 0x1eee4 FIRCLSProcessRecordAllThreads + 184 1 FirebaseCrashlytics 0x1f2c4 FIRCLSProcessRecordAllThreads + 1176 2 FirebaseCrashlytics 0x16518 FIRCLSHandler + 48 3 FirebaseCrashlytics 0x18cd8 FIRCLSMachExceptionServer + 688 4 libsystem_pthread.dylib 0x19ac _pthread_start + 148 5 libsystem_pthread.dylib 0xe68 thread_start + 8 Thread 0 libsystem_kernel.dylib 0x1a74 __workq_kernreturn + 8 1 libsystem_pthread.dylib 0x1108 _pthread_wqthread + 364 2 libsystem_pthread.dylib 0xe5c start_wqthread + 8 com.apple.NSURLConnectionLoader 0 libsystem_kernel.dylib 0x14a0 mach_msg_trap + 8 1 libsystem_kernel.dylib 0x1ae4 mach_msg + 76 2 CoreFoundation 0x6d30 __CFRunLoopServiceMachPort + 372 3 CoreFoundation 0xb1bc __CFRunLoopRun + 1180 4 CoreFoundation 0x1ebc8 CFRunLoopRunSpecific + 600 5 CFNetwork 0x2781dc _CFURLStorageSessionDisableCache + 60032 6 Foundation 0x6941c __NSThread__start__ + 808 7 libsystem_pthread.dylib 0x19ac _pthread_start + 148 8 libsystem_pthread.dylib 0xe68 thread_start + 8 WebThread 0 libsystem_kernel.dylib 0x1f24 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x8298 _pthread_cond_wait + 1236 2 JavaScriptCore 0x49d08 ***::ParkingLot::parkConditionallyImpl(void const*, ***::ScopedLambda<bool ()> const&, ***::ScopedLambda<void ()> const&, ***::TimeWithDynamicClockType const&) + 2076 3 JavaScriptCore 0x3a5e4 ***::LockAlgorithm<unsigned char, (unsigned char)1, (unsigned char)2, ***::EmptyLockHooks<unsigned char> >::lockSlow(***::Atomic<unsigned char>&) + 216 4 WebCore 0xbe7228 <redacted> + 280 5 WebCore 0xbea0e8 <redacted> + 48 6 CoreFoundation 0x410c4 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36 7 CoreFoundation 0x10080 __CFRunLoopDoObservers + 592 8 CoreFoundation 0xb30c __CFRunLoopRun + 1516 9 CoreFoundation 0x1ebc8 CFRunLoopRunSpecific + 600 10 WebCore 0xbe9d9c <redacted> + 760 11 libsystem_pthread.dylib 0x19ac _pthread_start + 148 12 libsystem_pthread.dylib 0xe68 thread_start + 8 AVAudioSession Notify Thread 0 libsystem_kernel.dylib 0x14a0 mach_msg_trap + 8 1 libsystem_kernel.dylib 0x1ae4 mach_msg + 76 2 CoreFoundation 0x6d30 __CFRunLoopServiceMachPort + 372 3 CoreFoundation 0xb1bc __CFRunLoopRun + 1180 4 CoreFoundation 0x1ebc8 CFRunLoopRunSpecific + 600 5 AudioSession 0x6f04 CADeprecated::GenericRunLoopThread::Entry(void*) + 164 6 AudioSession 0x108f0 CADeprecated::CAPThread::Entry(CADeprecated::CAPThread*) + 92 7 libsystem_pthread.dylib 0x19ac _pthread_start + 148 8 libsystem_pthread.dylib 0xe68 thread_start + 8 Thread 0 libsystem_kernel.dylib 0x1a74 __workq_kernreturn + 8 1 libsystem_pthread.dylib 0x1108 _pthread_wqthread + 364 2 libsystem_pthread.dylib 0xe5c start_wqthread + 8
Posted
by mvn271192.
Last updated
.