Post

Replies

Boosts

Views

Activity

Reply to Click circle image and navigate new SwiftUI
I really appreciate your effort to explain, but I am saying I do not understand what you mean by the word navigate or open. Please try to explain without using such words. The question in the link is marked as This question needs details or clarity. Quite reasonable. You need to add details or clarify your question without using ambiguous words like navigate or open. What do you want? NavigationLink like behavior? sheet? fullScreenCover?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21
Reply to Click circle image and navigate new SwiftUI
All my code here Thanks for showing your code. But your code does not compile showing error on line 16. Can you show a buildable code? (Please do not forget to include the first line of your View.) When I write my code like that circle image in toolbar padding bottom. I want to fixed image in toolbar. Sorry, I do not understand this part.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21
Reply to onDelete change label
I changed the Language to German Seems you are missing one of my replies. I have added Japanese (ja) to Localizations of PROJECT./Info. And set the Language of the simulator to 日本語(Japanese), then the swipe action for "Delete" is shown as "削除" (meaning "Delete" in Japanese). I believe this may work for your project using Deutsch, assuming the base development language of your project is English (Xcode default). 
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21
Reply to onDelete change label
Yes, but where can I found the PROJECT./Info, or is it the file info.plist? Select the project icon in the Project navigator. You can find PROJECT and TARGET in the left hand pane of editing area. Choose the project icon just below the title PROJECT. You can find tabs showing Info, Build Settings and Swift Packages. Choose Info.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21
Reply to Swift segue not working, unexpectedly found nil
Seems your code causes error when you show LoginViewController, not when segue to SignUpViewController. (You should better show on which line the error is shown, that may prevent misunderstanding.) This line is the worst part of your code:     let loginController = LoginViewController() When you create a design of a view controller using storyboard, calling initializer init() like LoginViewController() just creates a garbage object which causes unexpectedly found nil and would never work. Why don't you use instantiateViewController(identifier:) as you do in LoginViewController: class MainViewController: UINavigationController { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .white if isLoggedIn() { //#↓ If `TabBarViewController` does not suit for `init()` this may cause problems let tabBarController = TabBarViewController() viewControllers = [tabBarController] } else { //I do not understand why you put 0.01 sec delay, //but you should better not use `perform(_:with:afterDelay:)` DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) { self.showLoginController() } } } fileprivate func isLoggedIn() - Bool { return UserDefaults.standard.isLoggedIn() } private func showLoginController() { //#↓ When you instantiate a view controller desinged on the storyboard, //you should use `instantiateViewController(identifier:)` guard let loginController = self.storyboard?.instantiateViewController(identifier: "loginVC") as? LoginViewController //#- Replace `"loginVC"` to the right Storyboard ID else { print("Storyboard is not configured as expected") return } present(loginController, animated: true, completion: { //If you do nothing here, you can pass `nil` to `completion:` }) } } (Put a Storyboard ID to LoginViewController, and use it in instantiateViewController(identifier:). I haven't checked other parts of your code. If this does not work, please tell me with detailed description.
Topic: UI Frameworks SubTopic: UIKit Tags:
Mar ’21
Reply to onDelete change label
What could I make wrong? Sorry, hard to say without checking your project and the simulators you used. I have done the same things using German (Deutsch) and the Delete action is shown as Löschen. Better try with a brand-new project and see what happens.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21
Reply to how to pass data from UIViewController to TabBrController
I assume you mean some subclass of UITabBarController by tabbarviewcontroller. my expectation here is that the value should pass to the tabbarviewcontroller.  Embedding a UITabBarController into a UINavigationConroller is not a recommended UI design, but the code you have shown should work as the value should pass to the tabbarviewcontroller. (Assuming the UI is built programmatically also with your tabbarviewcontroller.) However, when I try to pass the object from loginViewcontroller to the tabbarviewcontroller, the properties are always nil. How have you checked it?
Topic: UI Frameworks SubTopic: UIKit Tags:
Mar ’21
Reply to how to pass data from UIViewController to TabBrController
Unfortunately viewDidLoad() may not be a good place to use passed values between view controllers. Please try this code: class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .cyan let randomStr = "dracarys" let nextController = TabBarViewController() print("TabBarViewController.init() finished") nextController.str = randomStr navigationController?.pushViewController(nextController, animated: true) } } class TabBarViewController : UITabBarController { var str: String? { didSet { debugPrint("TabBarViewController.set:str", str ?? "value is nil") if let vc1 = self.viewControllers?[0] as? ViewController1 { vc1.str = str } } } override func viewDidLoad() { super.viewDidLoad() let one = ViewController1() self.viewControllers = [one, ViewController2()] debugPrint("TabBarViewController.viewDidLoad", str ?? "value is nil") } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) debugPrint("TabBarViewController.viewWillAppear", str ?? "value is nil") } } class ViewController1 : UIViewController { var str: String? override func viewDidLoad() { super.viewDidLoad() debugPrint("ViewController1.viewDidLoad", str ?? "value is nil") view.backgroundColor = .red } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) debugPrint("ViewController1.viewWillAppear", str ?? "value is nil") } } class ViewController2 : UIViewController { override func viewDidLoad() { super.viewDidLoad() debugPrint("ViewController2.viewDidLoad") view.backgroundColor = .orange } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) debugPrint("ViewController2.viewWillAppear") } }
Topic: UI Frameworks SubTopic: UIKit Tags:
Mar ’21
Reply to Is there anyway to add something the shows there is an event happening on that day in a DatePicker?
Or would I have to create a custom calendar to do this? I'm afraid so. As far as I know and checked the documentations by Apple, and searched on the web for a short while, I could not find any options or modifiers to customize the calendar shown in GraphicalDatePickerStyle. You can send a feature request using Apple's Feedback Assistant.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21
Reply to Theme for View Controllers
I'm not sure if this would work for your purpose, but if you are using UIKit and not SwiftUI, you should better try modifying appearance proxy. Appearance Customization - https://developer.apple.com/documentation/uikit/appearance_customization An example: In AppDelegate func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) - Bool { // Override point for customization after application launch. UIView.appearance().backgroundColor = .red return true } Please remember, this may not work for some kinds of UI components, and some classes have their own appearance objects independently.
Topic: UI Frameworks SubTopic: UIKit Tags:
Mar ’21
Reply to @EnvironmentObject and Protocols?
what am I doing wrong? The type of @EnvirontmentObject must conform to ObservableObject. But, in Swift, usual protocols used as type cannot conform to any protocols. (In your declaration of AccessTokenProvider, : Authenticator works as a requirement of the protocol, but it does not mean AccessTokenProvider conforming to ObservableObject.) Under the current restriction of the type system of Swift, you cannot use protocol type for @EnvirontmentObject. You can start some discussion about this in forums.swift.org .
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21