Post

Replies

Boosts

Views

Activity

Reply to actionSheet failing to appear
You have an extra closing curly brace line 38. Hence, .actionsheet is applied to HStack and not Button as it should. Move ths curly brace line 46. If OK, don't forget to mark correct answer to close the thread. Good continuation.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’21
Reply to Force full screen on iOS
Not full screen: what do you get exactly ? have you checked that the viewController presentation is set to full screen and not automatic ? You can check it in IB. In code, I tried the following: vc.preferredBarTintColor = .clear vc.preferredControlTintColor = .clear vc.preferredContentSize = CGSize(width: 800, height: 1500) // No visible effect though present(vc, animated: true) It hides the top and bottom bar but not goes really fullscreen.
Topic: App & System Services SubTopic: Core OS Tags:
Apr ’21
Reply to Better understanding of ThermalState API for an iOS device
Why do you need numerical values for nominal fair serious critical ? The purpose is to let you react accordingly depending on the state, you don't need to know the value (which may be different on different models). In fact, are that those levels triggered by a single temp measurement ? Not sure. May be more composite evaluation. AFAIU, battery temp is one of the parameters considered in the evaluation. This link may be of some (limited) interest to you: https://discussions.apple.com/thread/7943287
Topic: App & System Services SubTopic: Core OS Tags:
Apr ’21
Reply to how to resolve Cannot find 'XXXX' in scope
You have 2 errors : // // ViewController.swift // Diabell // // Created by Richard Klug on 14/04/2021. // import UIKit import MessageUI class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } @IBAction func emailbButtonTapped( sender: Any) { showMailComposer() } } func showMailComposer() { guard MFMailComposeViewController.canSendMail() else { return } let composer = MFMailComposeViewController() composer.mailComposeDelegate = self composer.setToRecipients(["richard.klug@diabell.se"]) composer.setSubject("Diabell App Help") composer.setMessageBody("Fyll i vad du behöver hjälp med", isHTML: false) present(composer, animated: true) } need to conform to MFMailComposeViewControllerDelegate class ViewController: UIViewController, MFMailComposeViewControllerDelegate { Extra closing curly bracket line 21: remove it and put it line 34 Hence, the code after line 22 was out of the class, hence self not found and present does not apply to anything. So compiler tried to interpret as your own func. Correct code: class ViewController: UIViewController, MFMailComposeViewControllerDelegate { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } @IBAction func emailbButtonTapped( sender: Any) { showMailComposer() } func showMailComposer() { guard MFMailComposeViewController.canSendMail() else{ return } let composer = MFMailComposeViewController() composer.mailComposeDelegate = self composer.setToRecipients(["richard.klug@diabell.se"]) composer.setSubject("Diabell App Help") composer.setMessageBody("Fyll i vad du behöver hjälp med", isHTML: false) present(composer, animated: true) } } If that's OK, don't forget to mark the correct answer to close the thread. Note: when you post code, please use the code formatter tool ().
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’21
Reply to instantiated view controller displays for 1 second then segues to next view controller for no reason
Please be more precise. the view controller is displayed for literally a split second with the proper UI and everything Which controller ? nextVC (SchoolOnboarding) ? Another ? and it then automatically segues to the next view controller  Which segue ? To which controller ? Line 36 you push (not segue). Is it the transition you speak about ? Please also report all the prints you get on the console when you authenticate. This has never happened to me with segues before and I can't understand why it's happening now.  Because you have an error in your code !  I wanted to also add a new addition which was this view controller I want to instantiate but now this addition to the app won't even work properly. Please explain, it is totally unclear. So with this in mind, I was wondering if it's an issue with the TestFlight and the app's build number, so I incremented the build number and tried to run the app on the simulator  No link with build number.
Topic: Programming Languages SubTopic: Swift Tags:
Apr ’21
Reply to Swift UI best way to "cover" transition between two views
To try to understand what happens, I tried with a scale of 0.5 when green appears, it grows from 0.5 to full (1) whilst red does it reverse transition : moves back to bottom over a green view that grows progressively when red appears, it moves from bottom whilst the green does its inverse transition reducing from 1 to 0.5: you can see it reducing in the background before disappearing under red. if scale is 1, then in fact there is no transition to animate (1 - 1). Hence green simply disappear (without animation) whilst red appears, moving from bottom over a white screen (because green has disappeared) If scale is 0.9999, there is animation (0.9999 - 1), but that's so close to 1 that the effect is different: when green appears, it grows from 0.9999 to full (1): so it seems to immediately be there whilst red does it reverse transition : moves back to bottom, over a green view when red appears, it moves from bottom whilst the green does its inverse transition reducing from 1 to 0.9999: so green appears to stay in place, covered by the red that moves up. So what is important here is that you have in fact 2 animation running each time in parallel: red direct and green reverse (when red appears) red inverse and green direct when green appears. And scale: 1 leads to no transition at all.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’21
Reply to actionSheet failing to appear
Thanks for feedback. That's why it is so important to have correct indentation (select all code and type ctrl-I). You will immediately notice if you have a curly brace unbalance or missing parenthesis… In your case, you could see that .actionSheet(isPresented: $showInfo) was aligned with HStack.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’21
Reply to Why am I able to extend and override methods of NWConnection (which is a final class)?
Yes, that's curious you can redefine start(queue: DispatchQueue). The method itself is declared final: final func start(queue: DispatchQueue) Even more surprising, if you write override func start(queue: DispatchQueue) you get the compile error: Method does not override any method from its superclass. If I do same with another final class: final class MyUIVC : UIViewController { } extension MyUIVC { func removeFromParent() { } } I get the expected error: Overriding declaration requires an 'override' keyword Just as if start(queue: DispatchQueue) was not recognised in extension, but if I remove from extension, code still works, meaning start is recognised.
Topic: Programming Languages SubTopic: Swift Tags:
Apr ’21