Post

Replies

Boosts

Views

Activity

Drag drop nested list in swiftui
Hi, I managed to have a nested list in swiftui 3 (with foreach) and drag and drop to reorder the list when I enter the built-in edit mode. Problems / limitation when dragging / dropping a list item from edit mode: I can't change its nesting level: for example, if I drag an item that is 3 nested levels deep, I can't seem to be able to drop it on let's say level 1. When an item has children, and they are expanded, if I drag the father, the children will not follow. I can't drag from one section, and drop on another. What are the solutions to circumvent those problems? Is there built-in way to do it, if not, is it even possible without resorting to UIKit?
1
0
1.7k
Nov ’22
Position image inside UIButton
Hi, I have added a square image inside a UIButton. The goal is to have the square image on the left of the button, with space margin around 4 sides of button = 5. Here is the code: button.imageView?.contentMode = .scaleAspectFit button.contentHorizontalAlignment = .left; button.imageEdgeInsets = UIEdgeInsets(top: 5, left: 5, bottom: 5, right: 5) and here is the result: You can notice several problems: Right margin is > 5 (between button and text) Left margin > 5 The rest, aspect, and top and bottom margins are fine. How to have this button well on the left, and the text right next to it?
0
0
3.0k
Jun ’21
Subclassing UIButton doesn't change font size
Hi, here is a class for a UIKIT button. Some of those settings work, usch as cornerRadius: it does affect the button display, but some doesn't. For example, the size from    self.titleLabel?.font = UIFont(name: "Avenir Next Condensed Regular", size: 3) has no effect at all on the text of the font inside the buttons. Why is that? And how can I effectively alter the size of text from this subclass? class VotingButtonStyle: UIButton {       override func draw(_ rect: CGRect) {     super.draw(rect)     self.clipsToBounds = true     self.titleLabel?.font = UIFont(name: "Avenir Next Condensed Regular", size: 3)     self.setTitleColor(.black, for: .normal)     self.titleLabel?.numberOfLines = 3     self.layer.cornerRadius = 8   }     }
4
0
3.8k
Jun ’21
What is the earliest method to put in and trigger a performSegue?
Hi, I need the fastest, earliest programmatic transition possible from one vc to another. So I need to have  performSegue(withIdentifier: "fromEntryToVoting", sender: nil) performed as fast as possible so the transition happens as quickly as possible. But the vc containing this method should remain in the stack. It won't work from ViewDidLoad but will work from viewDidAppear. Is there an earlier method I can use to put my performeSegue so it will be performed asap?
2
0
622
May ’21
Tab bar item localization
Hi, tabBarItem.title = "LevelsVC-TabBarItem".localize() with tabBarItem.title i'm able to localize title when it is in viewDidLoad or viewWillappear but the localization will only happen when the tab becomes actives, otherwise it will show default value. How could I localize, programmatically, the item title without the need to make it active?
11
0
3.1k
May ’21
Localization not loading in some cases
Hi, here is a curious behavior hapening to my app. Here is the use case. App base lang is english. Other translation is french On a view controller, I have this:  self.introTextView.text = "DogProfileEditionVC-IntroTextView".localize() On corresponding language files I have these: "DogProfileEditionVC-IntroTextView" = "french text"; "DogProfileEditionVC-IntroTextView" = "english text"; Use case on a freshly opened or built app: Load viewcontroller. Text is correctly displayed in language. dismiss view controller. Open view controller again: text loaded is neither from the translation file, but from the storyboard. So on first loading after app was closed, opened, or built, the view controller shows correct text. On subsequent display, it ignores translation files and only load text from storyboard. This happens only one one view controller, and 3 texts. This doesn't happen on some text on the same VC. Why this strange behavior? Why does it localize only on first presentation of the view controller, and not on subsequent opening unless I close app in between? (i tried to reinstall app, clean build folder) Here are the string extensions used to localize: // Add method to Strings for easily triggering the localization process. extension String {   func localize() - String {     return NSLocalizedString(       self,       tableName: "Localizable",       bundle: .main,       value: self,       comment: self)   }       public func localize(with arguments: [CVarArg]) - String {     return String(format: self.localize(), locale: nil, arguments: arguments)   } }
3
0
3.3k
May ’21
How to best handle this localization scenario?
Hello, here is a particular localization scenario i'm not sure how to handle with default localization feature: App base language is english, translation is french. 1) On app load, swift will pick up 6 random items from a strings array of 100 items. 2) It will display each of those 6 strings on 6 user interface buttons. 3) User will tap on a button: string value is sent back into app. Here is the problem: 4) App will do processing with this value. Problem is that all internal processing from that values that went out from the array on user interface then back in app, is all done with english values. In particular that user choice is saved in external database, and I can't have saved in database localized versions: all internal processing on array values in english. How best to handle this situation? Is it possible from a localized french VALUE, to get corresponding VALUE in base language? If yes how? Or should I build my own thing for those cases when random values goes out on UI, then back in app... like an array of tuples containing translated items?
5
0
907
May ’21
Drag drop nested list in swiftui
Hi, I managed to have a nested list in swiftui 3 (with foreach) and drag and drop to reorder the list when I enter the built-in edit mode. Problems / limitation when dragging / dropping a list item from edit mode: I can't change its nesting level: for example, if I drag an item that is 3 nested levels deep, I can't seem to be able to drop it on let's say level 1. When an item has children, and they are expanded, if I drag the father, the children will not follow. I can't drag from one section, and drop on another. What are the solutions to circumvent those problems? Is there built-in way to do it, if not, is it even possible without resorting to UIKit?
Replies
1
Boosts
0
Views
1.7k
Activity
Nov ’22
How to provide a rich text WYSIWYG to user?
Hi, I want users of a swiftui app to be able to enter text in a field, and to: Change text style Change text size Add bullet lists What's the general direction I should take to implement this, possibly without using an external library?
Replies
2
Boosts
0
Views
1.1k
Activity
Dec ’21
Position image inside UIButton
Hi, I have added a square image inside a UIButton. The goal is to have the square image on the left of the button, with space margin around 4 sides of button = 5. Here is the code: button.imageView?.contentMode = .scaleAspectFit button.contentHorizontalAlignment = .left; button.imageEdgeInsets = UIEdgeInsets(top: 5, left: 5, bottom: 5, right: 5) and here is the result: You can notice several problems: Right margin is > 5 (between button and text) Left margin > 5 The rest, aspect, and top and bottom margins are fine. How to have this button well on the left, and the text right next to it?
Replies
0
Boosts
0
Views
3.0k
Activity
Jun ’21
Testflight app review required sign in
Hi, i'm about to submit my app to Testflight review team. My app requires sign in. But I only allow sign in from Apple and Facebook. There is no way I can provide a username / password. Can the review team sign in from Apple directly?
Replies
0
Boosts
0
Views
663
Activity
Jun ’21
Subclassing UIButton doesn't change font size
Hi, here is a class for a UIKIT button. Some of those settings work, usch as cornerRadius: it does affect the button display, but some doesn't. For example, the size from    self.titleLabel?.font = UIFont(name: "Avenir Next Condensed Regular", size: 3) has no effect at all on the text of the font inside the buttons. Why is that? And how can I effectively alter the size of text from this subclass? class VotingButtonStyle: UIButton {       override func draw(_ rect: CGRect) {     super.draw(rect)     self.clipsToBounds = true     self.titleLabel?.font = UIFont(name: "Avenir Next Condensed Regular", size: 3)     self.setTitleColor(.black, for: .normal)     self.titleLabel?.numberOfLines = 3     self.layer.cornerRadius = 8   }     }
Replies
4
Boosts
0
Views
3.8k
Activity
Jun ’21
What is the earliest method to put in and trigger a performSegue?
Hi, I need the fastest, earliest programmatic transition possible from one vc to another. So I need to have  performSegue(withIdentifier: "fromEntryToVoting", sender: nil) performed as fast as possible so the transition happens as quickly as possible. But the vc containing this method should remain in the stack. It won't work from ViewDidLoad but will work from viewDidAppear. Is there an earlier method I can use to put my performeSegue so it will be performed asap?
Replies
2
Boosts
0
Views
622
Activity
May ’21
Tab bar item localization
Hi, tabBarItem.title = "LevelsVC-TabBarItem".localize() with tabBarItem.title i'm able to localize title when it is in viewDidLoad or viewWillappear but the localization will only happen when the tab becomes actives, otherwise it will show default value. How could I localize, programmatically, the item title without the need to make it active?
Replies
11
Boosts
0
Views
3.1k
Activity
May ’21
Localization not loading in some cases
Hi, here is a curious behavior hapening to my app. Here is the use case. App base lang is english. Other translation is french On a view controller, I have this:  self.introTextView.text = "DogProfileEditionVC-IntroTextView".localize() On corresponding language files I have these: "DogProfileEditionVC-IntroTextView" = "french text"; "DogProfileEditionVC-IntroTextView" = "english text"; Use case on a freshly opened or built app: Load viewcontroller. Text is correctly displayed in language. dismiss view controller. Open view controller again: text loaded is neither from the translation file, but from the storyboard. So on first loading after app was closed, opened, or built, the view controller shows correct text. On subsequent display, it ignores translation files and only load text from storyboard. This happens only one one view controller, and 3 texts. This doesn't happen on some text on the same VC. Why this strange behavior? Why does it localize only on first presentation of the view controller, and not on subsequent opening unless I close app in between? (i tried to reinstall app, clean build folder) Here are the string extensions used to localize: // Add method to Strings for easily triggering the localization process. extension String {   func localize() - String {     return NSLocalizedString(       self,       tableName: "Localizable",       bundle: .main,       value: self,       comment: self)   }       public func localize(with arguments: [CVarArg]) - String {     return String(format: self.localize(), locale: nil, arguments: arguments)   } }
Replies
3
Boosts
0
Views
3.3k
Activity
May ’21
Any good template for app's web site?
Hi, do you have any advice for quickly building an iOS App's website? It will be very simple: frontpage, privacy, contact page.... I'm ok with pure html template, php, or wordpress templates, or any other smart way of doing this. Thanks, Aldar
Replies
0
Boosts
0
Views
597
Activity
May ’21
How to best handle this localization scenario?
Hello, here is a particular localization scenario i'm not sure how to handle with default localization feature: App base language is english, translation is french. 1) On app load, swift will pick up 6 random items from a strings array of 100 items. 2) It will display each of those 6 strings on 6 user interface buttons. 3) User will tap on a button: string value is sent back into app. Here is the problem: 4) App will do processing with this value. Problem is that all internal processing from that values that went out from the array on user interface then back in app, is all done with english values. In particular that user choice is saved in external database, and I can't have saved in database localized versions: all internal processing on array values in english. How best to handle this situation? Is it possible from a localized french VALUE, to get corresponding VALUE in base language? If yes how? Or should I build my own thing for those cases when random values goes out on UI, then back in app... like an array of tuples containing translated items?
Replies
5
Boosts
0
Views
907
Activity
May ’21