I'm using UITextView.
I set its background color to .white.
Initially, the UITextView appears with a white background color.
However, after I click on the UITextView, a cursor appears and the background color changes to .systemBackground.
I am unable to change this background color by any means.
UIKit
RSS for tagConstruct and manage graphical, event-driven user interfaces for iOS or tvOS apps using UIKit.
Post
Replies
Boosts
Views
Activity
My Keyboard Extension has high memory usage for having UILabels with large font size. The keyboard has emojis in a single view with UICollectionView. I noticed that the bigger font size I use, the more memory usage I have. I set font size approximately to 25 and when scrolling through emojis, the memory usage goes up to 250mb. If I reduce the font size to 10, the memory usage goes down to 70mb when scrolled. The keyboard extension has 75mb memory usage. I've had my keyboard app uploaded for years and had no issues with memory usage but with recent OS update, my keyboard started crashing a lot due to memory usage and it's due to UILabel. Would it be possible to increase the memory limit or exception on the memory usage caused by the OS for large fonts stored as bitmap?
When zoom in, CATiledLayer works very well. It shows previous layer while rendering next layer. I cannot aware the rendering.
When zoom out, it sucks. It leaves blank when rendering smaller scale layer.
How can I solve this???
For example, when downscale, put the draw rect into main thread?
This is more of a request I hope y'all will consider.
Please back port uniformAcrossSiblings to iOS 13 (or maybe just 15?) (https://developer.apple.com/documentation/uikit/nscollectionlayoutdimension/4173072-uniformacrosssiblings)
It's like the iOS 9 UIStackView problem. Amazing new feature nobody can use.
Has anyone else done this themselves with either custom or subclass UICollectionViewCompositionalLayout?
Having an issue with crashes on iOS 16 and iOS 17 devices. App works and will appear to operate normally. However after a while the app will crash with a EXC_BREAKPOINT on libobjc.A.dylib object_getClass. The root cause seems to be something related to UIViews/Core Animation, I think. However the root crash trigger seems to be a half a dozen different triggers from the UI on main thread. It also only triggers on release builds, or the dev builds take a lot longer to trigger to the point it's very difficult to reproduce.
Here are some examples of the crashes occurring.
Crashed: com.apple.main-thread
0 libobjc.A.dylib 0xe838 object_getClass + 48
1 Foundation 0x1c854 _NSKeyValueObservationInfoGetObservances + 264
2 Foundation 0x1bd1c NSKeyValueWillChangeWithPerThreadPendingNotifications + 232
3 QuartzCore 0x59408 CAAnimation_setter(CAAnimation*, unsigned int, _CAValueType, void const*) + 128
4 QuartzCore 0x749b4 -[CAAnimation setBeginTime:] + 52
5 QuartzCore 0x728b4 CA::Layer::commit_animations(CA::Transaction*, double (*)(CA::Layer*, double, void*), void (*)(CA::Layer*, CA::Render::Animation*, void*), void (*)(CA::Layer*, __CFString const*, void*), CA::Render::TimingList* (*)(CA::Layer*, void*), void*) + 740
6 QuartzCore 0x2aeac invocation function for block in CA::Context::commit_transaction(CA::Transaction*, double, double*) + 148
7 QuartzCore 0x2adb4 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 368
8 QuartzCore 0x2ad40 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 252
9 QuartzCore 0x2ad40 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 252
10 QuartzCore 0x2ad40 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 252
11 QuartzCore 0x2ad40 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 252
12 QuartzCore 0x2ad40 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 252
13 QuartzCore 0x2ad40 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 252
14 QuartzCore 0x2ad40 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 252
15 QuartzCore 0x2ad40 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 252
16 QuartzCore 0x2ad40 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 252
17 QuartzCore 0x2ad40 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 252
18 QuartzCore 0x6f548 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 11192
19 QuartzCore 0x65e3c CA::Transaction::commit() + 648
20 UIKitCore 0x924cc _afterCACommitHandler + 84
21 CoreFoundation 0x3583c __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
22 CoreFoundation 0x34244 __CFRunLoopDoObservers + 548
23 CoreFoundation 0x33960 __CFRunLoopRun + 1028
24 CoreFoundation 0x33478 CFRunLoopRunSpecific + 608
25 GraphicsServices 0x34f8 GSEventRunModal + 164
26 UIKitCore 0x22c62c -[UIApplication _run] + 888
27 UIKitCore 0x22bc68 UIApplicationMain + 340
0 libobjc.A.dylib 0x5d94 object_getClass + 48
1 Foundation 0xadb8 _NSKeyValueObservationInfoGetObservances + 248
2 Foundation 0x3f670 NSKeyValueWillChangeWithPerThreadPendingNotifications + 232
3 QuartzCore 0xbb18 CAAnimation_setter(CAAnimation*, unsigned int, _CAValueType, void const*) + 128
4 QuartzCore 0xcc14 -[CAPropertyAnimation setKeyPath:] + 52
5 QuartzCore 0xcbc0 +[CAPropertyAnimation animationWithKeyPath:] + 36
6 UIKitCore 0xc89fb0 -[UIMorphingLabel animateGlyph:toScale:delay:] + 308
7 UIKitCore 0xc8a1fc -[UIMorphingLabel animateShowGlyph:alpha:alphaDuration:delay:] + 196
8 UIKitCore 0xc8b3f0 -[UIMorphingLabel animateSubstitutionAlignmentHunkAtIndex:] + 1068
9 UIKitCore 0x42cd84 -[UIMorphingLabel animateGlyphs] + 276
10 UIKitCore 0xa374 -[UIMorphingLabel layoutSubviews] + 368
11 UIKitCore 0x4420 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1992
12 QuartzCore 0x9f30 CA::Layer::layout_if_needed(CA::Transaction*) + 500
13 QuartzCore 0x1d4ac CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 148
14 QuartzCore 0x2e8d8 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 444
15 QuartzCore 0x5de80 CA::Transaction::commit() + 648
16 QuartzCore 0x47df0 CA::Transaction::flush_as_runloop_observer(bool) + 88
17 CoreFoundation 0x90234 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
18 CoreFoundation 0x1a410 __CFRunLoopDoObservers + 532
19 CoreFoundation 0x7a19c __CFRunLoopRun + 1028
20 CoreFoundation 0x7f3ec CFRunLoopRunSpecific + 612
21 GraphicsServices 0x135c GSEventRunModal + 164
22 UIKitCore 0x39cf58 -[UIApplication _run] + 888
23 UIKitCore 0x39cbbc UIApplicationMain + 340
I'm at a loss, I'm clearly doing something wrong in the UIView/Core Animation side of things. Would be very grateful for anyone who can point me in the right direction.
I recently observed a distinction in the lookup behavior for an Asset within a specific Bundle when using UIImage.init(named:in:compatibleWith:) compared to Image.init(_:bundle:).
Consider a scenario where we have an asset named camera, and there is also an SF symbol with the name camera.fill.
We also have an Asset in our Swift Package and use its Bundle. In that case .module.
Now, when we use UIImage.init(named:in:compatibleWith:) and inject camera.fill and .module, the result of this initialization is not nil. It appears that UIImage has located something within our Asset.
On the other hand, when we inject camera.fill into Image.init(_:bundle:) using the same bundle, the result of this initialization is an empty Image, accompanied by a log entry stating: "No image named 'camera.fill' found in the asset catalog for /Users/.../.bundle." This behaviour aligns with expectations, as we don't have an explicitly named camera.fill within our Assets inside the bundle .module.
It appears that even though we injected camera.fill into UIImage.init(named:in:compatibleWith:), it found the first best match, in this case, the camera Asset. Meanwhile, Image.init(_:bundle:) found nothing explicitly named camera.fill within our Assets.
Doesn't it seem logical for both of these APIs to yield the same result? Perhaps, it would be even better if both APIs looked up the given name consistently, taking into account the provided bundle in the same way.
In my Iphone app, I want to open json files that I have earlier saved. The function I mention below to open the file is not firing when I share a file to my app.
I have implemented this in the info.plist file and this seems to work, because in Files I can share a .json file to may app.
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>JSON Document</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.json</string>
</array>
</dict>
</array>
I have added the function to open the file in my AppDelegate file.
func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
// Handle the file at the given URL
// You can perform actions based on the file type or content
print("Opening file!")
}
(the implementation is actually longer to work on the file).
When I share a file to my app, the app itself is opening but this method 'application' is never called.
I'm not sure whether I'm overlooking something. I have searched quite a while to see what I'm missing.
Any help is greatly appreciated!
Emile
Here is the set up.
I have a UITableViewController (controller 1), to which I get from a controller (0)
As I need to add a searchView atop the tableView, I addSubview to the superview.
This is done in viewWillAppear
self.view.superview?.addSubview(searchView) // AboveTableView
searchView.isHidden = true
print("willAppear", self.view.superview, self.tableView.superview)
It works perfectly well, I get:
willAppear Optional(<UIViewControllerWrapperView: 0x103d2eef0; frame = (0 0; 393 852); autoresize = W+H; layer = <CALayer:
From this VC, I segue to another VC (2) with a show segue and comes back with an unwindSegue to return to (1).
Problem is that no, superviews are nil.
@IBAction func unwindToTableViewController(_ sender: UIStoryboardSegue) {
print("unwind", self.view.superview, self.tableView.superview)
}
gives
unwind nil nil
If I step back from this controller (1) to the controller (0) from which I segued and segue again to the TableViewController (1), everything works as expected.
In addition, if I go from 1 -> 2 by instantiating (2), everything works OK when I unwind to (1).
I know a solution is to refactor code replacing UITableViewController with a UIViewController and embed a TableView inside. But I would like to understand why my present design does not work.
I have a view in storyboard, with a tableView and a coloured UIView.
The UIView is declared after tableView, so it appears on top of tableView.
However, it appears semi transparent over the tableView.
In addition, I cannot set its alpha channel to values other than 1 or 0 (e.g., 0.9)
But if I create the view programmatically, the view if fully opaque as expected.
What am I missing ?
Situation
I am implementing a filter view that has a button to apply the filters selected. The button shows how many results applying the current filters would yield.
Like this:
The label contains the count variable, the expectation is that when the count updates the button will reflect the new number of results.
Current setup
I am passing the data (count displayed in the button) like this: ViewModel -> View (SwiftUI) -> View (SwiftUI) -> UIViewControllerRepresentable -> UIViewController.
I have validated that the variable that holds the count updates whenever a filter is selected, but the button is not re-rendered to display the new value.
Here are some simplified code snippets (In the order described above):
ViewModel:
@MainActor class ViewModel: ObservableObject {
@Published var resultCount: Int = 0
@Published var status: String = ""
@Published var type: String = ""
init(){
self.addSubscribers()
})
}
func addSubscribers() {
// code here used to filter uses sink based on filters (status and type) selected, this will update resultCount
}
}
ContainerView:
struct ContainerView: View {
@EnvironmentObject private var vm: ViewModel
var body: some View {
VStack {
FilterView(status: $vm.status, type: $vm.type, resultCount: $vm.resultCount)
}
}
}
FilterView:
struct FilterView: View {
@Binding var status: String
@Binding var type: String
@Binding var resultCount: Int
var body: some View {
VStack {
FormViewControllerRepresentable(status: $status, type: $type, resultCount: $resultCount, showFilterSelectionView: $showFilterSelectionView)
}
}
}
FormViewControllerRepresentable:
struct FormViewControllerRepresentable: UIViewControllerRepresentable {
@Binding var status: String
@Binding var type: String
@Binding var resultCount: Int
func makeUIViewController(context: Context) -> FilterFormViewController {
FilterFormViewController(status: $status, type: $type, resultCount: $resultCount)
}
func updateUIViewController(_ uiViewController: FilterFormViewController, context: Context) {
uiViewController.status = status
uiViewController.type = type
uiViewController.resultCount = resultCount
}
}
UIViewController
class FilterFormViewController: UIViewController, UITextFieldDelegate {
@Binding var status: String
@Binding var type: String
@Binding var resultCount: Int
@Binding var showFilterSelectionView: Bool
init(status: Binding<String>, type: Binding<String>, resultCount: Binding<Int>, showFilterSelectionView: Binding<Bool>) {
self._status = status
self._type = type
self._resultCount = resultCount
self._showFilterSelectionView = showFilterSelectionView
super.init(nibName: nil, bundle: nil)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
lazy var formView = Form()
let stackView = UIStackView()
let scrollView = UIScrollView()
override func viewDidLoad() {
super.viewDidLoad()
setup()
}
func setup() {
// set delegate for Picker (filters)
formView.statusPicker.textField.delegate = self
formView.statusPicker.delegate = self
formView.typePicker.textField.delegate = self
formView.typePicker.delegate = self
stackView.addArrangedSubview(getButtonsStackView())
scrollView.addSubviews([stackView])
view.addSubview(scrollView)
}
func getButtonsStackView() -> UIStackView {
// HERE is the button. even though resultCount updates, the button is not re-rendered
// UIButton here is actually a custom component that conforms to UIButton. In the custom component setTitle(label, for: .normal) is called
let submitButton = UIButton( label: "Show \(self.resultCount) results")
submitButton.isEnabled = true
submitButton.addTarget(self, action: #selector(hideFilters), for: .touchUpInside)
let buttonsView = UIStackView(
arrangedSubviews: [
submitButton
]
)
return buttonsView
}
func textFieldDidEndEditing(_ textField: UITextField) {
// getters here are working well and setting the value for status & type is updating the variable in the viewModel
// THE PROBLEM IS: While this updates the value for the filters and that in turns updates the result count, the button won't re-render with the new value
status = formView.getStatus()
type = formView.getType()
}
}
Hey Team,
We started to get the NSInternalInconsistencyException crash only for iOS 17. The crash logs are very generic and don’t point to any specific screen or code that’s why it's hard to figure out the root cause for this. We already tried running the main thread checker but we didn’t get any thread issues.
Kindly help.
Crash Logs:
Fatal Exception: NSInternalInconsistencyException
Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.
0 CoreFoundation 0xec870 __exceptionPreprocess
1 libobjc.A.dylib 0x2bc00 objc_exception_throw
2 CoreAutoLayout 0x56c8 NSISSparseVectorAddTermWithPlaceValueCoefficientStartingIndex
3 CoreAutoLayout 0xbadc -[NSISEngine _optimizeWithoutRebuilding]
4 CoreAutoLayout 0xb7f0 -[NSISEngine optimize]
5 CoreAutoLayout 0xb57c -[NSISEngine performPendingChangeNotifications]
6 UIKitCore 0x33f38 -[UIView(Hierarchy) layoutSubviews]
7 UIKitCore 0x32694 -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
8 QuartzCore 0x671c0 CA::Layer::layout_if_needed(CA::Transaction*)
9 QuartzCore 0x66d48 CA::Layer::layout_and_display_if_needed(CA::Transaction*)
10 QuartzCore 0x6d278 CA::Context::commit_transaction(CA::Transaction*, double, double*)
11 QuartzCore 0x66574 CA::Transaction::commit()
12 QuartzCore 0x1fe504 CA::Transaction::release_thread(void*)
13 libsystem_pthread.dylib 0x9f48 _pthread_tsd_cleanup
14 libsystem_pthread.dylib 0x4880 _pthread_exit
15 libsystem_pthread.dylib 0x5d7c _pthread_wqthread_legacy_worker_wrap
16 libsystem_pthread.dylib 0x19ec _pthread_wqthread
17 libsystem_pthread.dylib 0x1a04 start_wqthread
Hi guys,
I am developing an app which is a messaging app and it needs to work smoothly.
However, I ran into an issue where I couldn't scroll over RTL text properly. It doesn't matter whether I am using UIKit or SwiftUI it just stutters.
I tested out on an iPad with a promotion display / iPhone XS and 15 pro-Max and the result was the same.
Someone said using an RTL font could resolve the issue however it did not.
And if you uncomment the line 48 and comment the line 49 you will see the app run smoothly without a hitch.
It is overtly clear in messaging apps that the app stutters, and our users have complained about it a lot.
struct UItableViewTest: View {
var body: some View {
SwiftUI.NavigationStack {
NavigationLink {
RandomItemsTableViewControllerWrapper()
} label: {
Text("move to table view controller")
}
}
}
}
struct RandomItemsTableViewControllerWrapper: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> UIViewController {
return RandomItemsTableViewController()
}
func updateUIViewController(_ uiViewController: UIViewController, context: Context) {}
}
class RandomItemsTableViewController: UITableViewController {
private let cellReuseIdentifier = "Cell"
private var items: [String] = []
private let font = UIFont(name: "RTLFONT", size: 16)
override func viewDidLoad() {
super.viewDidLoad()
generateRandomItems()
tableView.register(UITableViewCell.self, forCellReuseIdentifier: cellReuseIdentifier)
}
private func generateRandomItems() {
let maxRTLLength = MockTexts.rtlText.count
let numberOfItems = 100
for _ in 0..<numberOfItems {
let randomLength = Int.random(in: 10...maxRTLLength)
let randomRTL = Bool.random()
// let randomText = String(MockTexts.loremIpsum.prefix(randomLength))
let randomText = String(randomRTL ? MockTexts.rtlText.prefix(randomLength) : MockTexts.loremIpsum.prefix(randomLength))
items.append(randomText)
}
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: cellReuseIdentifier, for: indexPath)
cell.textLabel?.text = items[indexPath.row]
cell.textLabel?.numberOfLines = 0
cell.textLabel?.font = font
return cell
}
}
#Preview {
UItableViewTest()
}
struct MockTexts {
static let loremIpsum = """
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed commodo gravida sagittis.\n Nulla facilisi. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; \n Nam eleifend metus leo, id maximus ante posuere ac.\n Fusce ultrices fringilla malesuada.\n Sed eget lectus ut nisl condimentum scelerisque.\n Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed commodo gravida sagittis.\n Nulla facilisi. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; \n Nam eleifend metus leo, id maximus ante posuere ac.\n Fusce ultrices fringilla malesuada.\n Sed eget lectus ut nisl condimentum scelerisque.\n Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed commodo gravida sagittis.\n Nulla facilisi. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; \n Nuada.\n Sed eget lectus ut nisl condimentum scelerisque.\n Pellentesque habit
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed commodo gravida sagittis.\n Nulla facilisi. Vesti
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed commodo gravida sagittis.\n Nulla facilisi. Vestiabitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed commodo gravida sagittis.\n Nulla facilisi. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; \n Nam eleifend metus leo, id maximus ante posuere ac.\n Fusce ultrices fringilla malesuad\n
te ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; \n Nam eleifend metus leo, id maximus ante posuere ac.\n Fusce ultrices fringilla malesuada.\n Sed eget lectus ut nisl condimentum scelerisque.\n Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
"""
static let rtlText = """
سلام این یه متن طولانی است که من برای تست دارم می نویسم ببینم چه جوری کار میکنه متن های خیلی طولانی فارسی.
سلام این یه متن طولانی است که من برای تست دارم می نویسم ببینم چه جوری کار میکنه متن های خیلی طولانی فارسی.
سلام این یه متن طولانی است که من برای تست دارم می نویسم ببینم چه جوری کار میکنه متن های خیلی طولانی فارسی.
سلام این یه متن طولانی است که من برای تست دارم می نویسم ببینم چه جوری کار میکنه متن های خیلی طولانی فارسی.
سلام این یه متن طولانی است که من برای تست دارم می نویسم ببینم چه جوری کار میکنه متن های خیلی طولانی فارسی.
سلام این یه متن طولانی است که من برای تست دارم می نویسم ببینم چه جوری کار میکنه متن های خیلی طولانی فارسی.
سلام این یه متن طولانی است که من برای تست دارم می نویسم ببینم چه جوری کار میکنه متن های خیلی طولانی فارسی.
سلام این یه متن طولانی است که من برای تست دارم می نویسم ببینم چه جوری کار میکنه متن های خیلی طولانی فارسی.
سلام این یه متن طولانی است که من برای تست دارم می نویسم ببینم چه جوری کار میکنه متن های خیلی طولانی فارسی.
سلام این یه متن طولانی است که من برای تست دارم می نویسم ببینم چه جوری کار میکنه متن های خیلی طولانی فارسی.
سلام این یه متن طولانی است که من برای تست دارم می نویسم ببینم چه جوری کار میکنه متن های خیلی طولانی فارسی.
سلام این یه متن طولانی است که من برای تست دارم می نویسم ببینم چه جوری کار میکنه متن های خیلی طولانی فارسی.
سلام این یه متن طولانی است که من برای تست دارم می نویسم ببینم چه جوری کار میکنه متن های خیلی طولانی فارسی.
سلام این یه متن طولانی است که من برای تست دارم می نویسم ببینم چه جوری کار میکنه متن های خیلی طولانی فارسی.
سلام این یه متن طولانی است که من برای تست دارم می نویسم ببینم چه جوری کار میکنه متن های خیلی طولانی فارسی.
سلام این یه متن طولانی است که من برای تست دارم می نویسم ببینم چه جوری کار میکنه متن های خیلی طولانی فارسی.
سلام این یه متن طولانی است که من برای تست دارم می نویسم ببینم چه جوری کار میکنه متن های خیلی طولانی فارسی.
سلام این یه متن طولانی است که من برای تست دارم می نویسم ببینم چه جوری کار میکنه متن های خیلی طولانی فارسی.
سلام این یه متن طولانی است که من برای تست دارم می نویسم ببینم چه جوری کار میکنه متن های خیلی طولانی فارسی.
سلام این یه متن طولانی است که من برای تست دارم می نویسم ببینم چه جوری کار میکنه متن های خیلی طولانی فارسی.
"""
}
How can I use this code in ContentView with the default augmented reality template provided by Xcode
Hey guys, I hope you are all doing well! I am really stuck on a problem and I need help here. I am new to Swift but I need to use Swift to complete a project. I am trying to use this code https://github.com/jmousseau/RoomObjectReplicatorDemo/blob/main/RoomObjectReplicatorDemo/ViewController.swift with the RoomObjectReplicator library https://github.com/jmousseau/RoomObjectReplicator. However, the issue is that my app is currently using SwiftUI and not UIKit. Furthermore, I have ContentView and ARViewContainer. How can I implement the code but use ContentView and ARViewContainer along with SwiftUI? Thanks in advance!
Hi, I've got this html text:
"<style>* {font-size: 12pt !important;color: #000000 !important;font-family: Montserrat-Regular !important;}</style>Perform the following steps:<br><u>Option 1:</u><br><p>1) Upon receiving a push notification alert, tap on the push notification to launch BIMB Authenticator</p><p>2) Verify the transaction details and choose \"Approve\"</p><p>3) Complete</p><br><u>Option 2:</u><br><ol><p>1) If you didn’t receive push notification, you may launch BIMB Authenticator</p><p>2) Verify the transaction details and choose \"Approve\"</p><p>3) Complete</p>"
And I'm trying to show this HTML text properly in a UILabel. This is my codes:
String extension to map to NSAttributedString:
extension String {
func attributedStringFromHTML() -> NSAttributedString? {
guard let data = "\(self)"
.data(using: .utf8, allowLossyConversion: false) else {
Log.error(category: .transaction, message: "Unable to decode data from html string: %@", self)
return nil
}
let options: [NSAttributedString.DocumentReadingOptionKey: Any] = [
.documentType: NSAttributedString.DocumentType.html,
.characterEncoding: String.Encoding.utf8.rawValue
]
if let attributedString = try? NSAttributedString(data: data, options: options, documentAttributes: nil) {
return attributedString
} else {
Log.error(category: .transaction,
message: "Unable to create attributed string from html string: %@",
self)
return nil
}
}
}
And this is the result:
Can you tell me how to fix this? Thanks.
Anyone knows about any workarounds for this crash "Spatial presentations are not permitted from popovers."
Hi!
How i can set cornerRadius to UIContextualAction element without any frameworks in UIKit?
Now i found way to set image or title to this action.
I want to use uitableview in tvos to show list of string data but compiler is throughing following errors in generated header:
"No type or protocol named 'UITableViewDataSource'"
And "Attempting to use the forward class 'UITableView' as superclass of 'TWOSSelectionTableTVOS'"
Even though this code is working is ios .
My code structure is as follow :
SelectionTable.swift:
import UIKit
class TWOSSelectionTableTVOS : UITableView
{
private var vDataSrc:[String]!
func SetDataSrc (_ pDataSrc:[String])
{
self.vDataSrc = pDataSrc
}
func UpdateDataSrc (_ pStringList:[String])
{
self.vDataSrc += pStringList
}
func GetDataSrc () -> [String]
{
return self.vDataSrc
}
}
PaintUI.swift :
import UIKit
@objc
class PaintUI: NSObject,UITableViewDelegate, UITableViewDataSource {
static let uShared = PaintUI ()
@objc
static func updateUIMessage() {
DispatchQueue.main.async {
ExecuteInlineSelectionTable ()
}
}
func tableView (_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 5
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell (withIdentifier: "cell", for: indexPath)
cell.textLabel?.text = "hello"
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let viewcontroller: TWIOSViewController!
viewcontroller = StaticContext.sViewController
}
public static func ExecuteInlineSelectionTable ()
{
let selectiontable:TWOSSelectionTableTVOS!
selectiontable = TWOSSelectionTableTVOS ()
selectiontable.register (UITableViewCell.self, forCellReuseIdentifier: "cell")
selectiontable.dataSource = uShared
selectiontable.delegate = uShared
selectiontable.isScrollEnabled = true
// TODO : will add selection table in view heriearchy but currently getting
// compilation error
}
}
And finally calling PaintUI.updateUIMessage () , it is throughing above errors for tvOS only but in case of ios code is working fine.
when i am adding new view to replace viewcontroller's view like this :
let viewcontroller: UIViewController!
let rootview:UIView!
viewcontroller = UIViewController ()
rootview = UIView (frame:viewcontroller.view.bounds)
viewcontroller.view = rootview
// Adding a button
let button = UIButton(type: .system)
button.setTitle("Tap Me", for: .normal)
button.titleLabel?.font = UIFont.systemFont(ofSize: 18)
button.addTarget(self, action: #selector(buttonTapped), for:.allEvents)
viewcontroller.view.addSubview(button)
For ios(iPhone/ipad) , i am able to get button click event .
But in case of tvOS , i am not getting button click event.
But in case of tvOS if use the default view of viewcontroller like this , i am getting button click events and things works fine:
let viewcontroller: UIViewController!
viewcontroller = UIViewController ()
// Adding a button
let button = UIButton(type: .system)
button.setTitle("Tap Me", for: .normal)
button.titleLabel?.font = UIFont.systemFont(ofSize: 18)
button.addTarget(self, action: #selector(buttonTapped), for:.allEvents)
viewcontroller.view.addSubview(button)
Is this some bug for tvOS or for tvOS this suppose to happen this way ?
I am experiencing a transition issue like the video
https://drive.google.com/drive/folders/17DheHb6wh8d2ZizTXmTpu7FalTDTJvTY
This issues occur intermittently and, even the system animation(keyboard) is included.
Im using pure swiftUI and The Composable Architecture.
I don’t know the exact cause. I don’t have a great idea for solve this issue.
I am creating an app where i am opening the direct share extension in app for different apps like instagram, snapchat and whatsapp. It is working fine i know there share extension bundle id and it open perfectly. I also need to open the iMessages share extension in app i have found the bundle id of iMessage share extension it is com.apple.UIKit.activity.Message but when i try to open it got error extension not found.
Any one have any idea how i can find the right bundle if for iMessage share extension ?
I am using an iOS SPM package LNExtensionExecutor and create a bridge between React Native and this native package.