Post

Replies

Boosts

Views

Activity

Reply to Swift functions
Your question is not very clear. Do you want to print (where ?) or do you want to display the matrix on screen in a Label, TextField, TextView ? To print in log, simply do: for x in xo { print(x) }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’21
Reply to How do I get 'checking null' to finish?
Did you try to: Shut down your Mac, then turn it on and immediately press these four keys simultaneously: Option, Command, P, and R. Hold them down for about 20 seconds. This operation clears the user settings from memory and restores some security features that may have been changed. See details here: https://support.apple.com/en-us/HT204063 and https://discussions.apple.com/thread/8642800
Topic: App & System Services SubTopic: Core OS Tags:
Apr ’21
Reply to Notifications and ViewControllers
First, I formatted your code to make it easier to grasp. I see nowhere any reference to notification. How do you want to open ? when user taps the notification ? other ? What is it more specifically you don't know how to do ? For User Notification, I advise to read first this tutorial, which explain the whole process from registering to processing notification. https ://www.raywenderlich. com/11395893-push-notifications-tutorial-getting-started import UIKit import Firebase @main class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) - Bool { FirebaseApp.configure() return true } // MARK: UISceneSession Lifecycle func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) - UISceneConfiguration { return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) } func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: SetUISceneSession) { } } // TheRiddle ViewController: import UIKit import SafariServices import WebKit import Firebase class TheRiddle: UIViewController { @IBOutlet weak var leading_TheRiddle: NSLayoutConstraint! @IBOutlet weak var trailing_TheRiddle: NSLayoutConstraint! @IBOutlet weak var CurrentRiddle: UILabel! @IBOutlet weak var PreviousRiddle: UILabel! var menuOut = false override func viewDidLoad() { super.viewDidLoad() let db = Firestore.firestore() db.collection("TheRiddle").document("Riddles").getDocument { (document, error) in //check for error if error == nil { //check if document exists if document != nil { } else { if let currentRiddle = document!.get("CurrentRiddle") as? String { self.CurrentRiddle.text = "This Weeks Riddle: " + currentRiddle } if let previousRiddle = document!.get("CurrentRiddle") as? String { self.CurrentRiddle.text = "Previous Riddle: " + previousRiddle } } } } } @IBAction func RiddleAnswerForm(_ sender: Any) { let vc = SFSafariViewController(url: URL(string: "https://forms.office.com/Pages/ResponsePage.aspx?id=ytAqTDte6UK-KD5v_kOm4Y843IzqmYtFlDtLrfRYsi1UMFpUMk1GN01GS05BVFlJUElONk4yR1hKUCQlQCN0PWcu")!) present(vc, animated: true) } @IBAction func menuTappedTheRiddle(_ sender: Any) { if menuOut == false { leading_TheRiddle.constant = 150 trailing_TheRiddle.constant = -150 menuOut = true } else { leading_TheRiddle.constant = 0 trailing_TheRiddle.constant = 0 menuOut = false } UIView.animate(withDuration: 0.2, delay: 0.0, options: .curveEaseIn, animations: { self.view.layoutIfNeeded() }) { (animationComplete) in print("The animation is complete") } } }
Topic: Programming Languages SubTopic: Swift Tags:
Apr ’21
Reply to Developing on Catalina?
You cannot. I checked and got the same problem. So, when you create the project: select MacOS App (as you did) but select AppKit App Delegate LifeCycle Doing so you'll use SwiftUI 1.0 and not 2.0 which runs only on Big Sur. I tested, it works. If that works, don't forget to close the thread.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’21
Reply to Swift functions
Your answers are absolutely confusing. If you want a matrix in x0, declare var matrix = [[String]]() // Array of Arrays ; changed the name to be more meaningful and populate as follows: var xo1 = ["x", "10","10","10","10"] var xo2 = ["10 ","x", "10","10","10"] var xo3 = ["10 ","10","x" ,"10","10"] var xo4 = ["10 ","10","10","x" ,"10"] var xo5 = ["10 ","10","10","10","x"] matrix.append(xo1) matrix.append(xo2) matrix.append(xo3) matrix.append(xo4) matrix.append(xo5) Then with print(matrix) you get [["x", "10", "10", "10", "10"], ["10 ", "x", "10", "10", "10"], ["10 ", "10", "x", "10", "10"], ["10 ", "10", "10", "x", "10"], ["10 ", "10", "10", "10", "x"]] Or with: for row in matrix {     print(row) } you get ["x", "10", "10", "10", "10"] ["10 ", "x", "10", "10", "10"] ["10 ", "10", "x", "10", "10"] ["10 ", "10", "10", "x", "10"] ["10 ", "10", "10", "10", "x"] Is it what you are looking for ? If so, don't forget to close the thread on this answer. Otherwise, please explain what different output you want.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’21