Post

Replies

Boosts

Views

Activity

Reply to how to get the app delegate file on Xcode
Xcode 13 does not have a Life Cycle menu. New projects use the SwiftUI app life cycle.  I just tested in Xcode 1313.0ß. I created a new project, selected Storyboard, Swift language. I do get AppDelegate and SceneDelegate files created automatically. What you cannot do is have a SwiftUI project and select UIKit lifecycle. But that does not prevent to have a storyboard/UIKit project. Which is good news.
Jul ’21
Reply to Use of Airdrop systematically
Users must allow to be contacted by Airdrop by anyone or by you if you are in their contacts. Here is an implementation example (a bit old and ObjC, but that shows the logic): http s : / / w w w .appcoda. com/ios7-airdrop-programming-tutorial/ And implementation using UIActivityViewController http s : / / w w w . hackingwithswift. com/articles/118/uiactivityviewcontroller-by-example
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’21
Reply to Using Xcode 12.5.1 (current ver)
The same app run on any other simulator Which simulator precisely ? Is it related to screen size ? will not load the table properly. That's not enough information. what do you get exactly ? No table at all ? empty table ? Ill positioned table ? … Could you show: the full code related to tableView screen copy of the constraints you defined for the tableView
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’21
Reply to How to refine the shape of an SKSpriteNode for tap gestures?
We can now include images, it is easier to have them in the post directly. I would try the following in tappedView: test where exactly the tap was and compare to the orange shape. If d is the semi width (and height) of the full square (position of orange top), the parts to exclude are: top left triangle : cond1 = x + y < d top right triangle : cond2 = x - y > d bottom right triangle : cone3 = x + y > 3 d bottom left triangle cond4 = y - x > d if let touchNode = node as? MyGem print("touched gem") if cond1 || cond2 || cond3 || cond4 { return // without doing anything } // else, OK highliteGem(theGem: touchNode, clearAll: false) return }
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’21
Reply to Segue from search results view controller to another view controller
when you tap on the result row, nothing happens Where is result row (a cell in which table) ? I suppose it is in the table of ResultsTableViewController ? Do I understand correctly that this table can contain either Decks or cards ? Is behaviour different for decks or cards, or is it the same "nothing happens" ? Did you check identifiers are effectively "cardsVC" and "cardDetailVC" (with same upper/lowercase) Could you instrument the code and tell what you get: override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { print("didSelect scope", scope, "indexPath", indexPath) if scope == "Decks" { print("Decks") guard let cardsVC = self.storyboard?.instantiateViewController(identifier: "cardsVC") as? CardsTableViewController else { print("cardsVC was not instantiated") return } cardsVC.selectedDeck = filteredDecks?[indexPath.row] print("cardsVC instantiated, with selectedDeck", cardsVC.selectedDeck) print("self.parent?.navigationController", self.parent?.navigationController) self.parent?.navigationController?.pushViewController(cardsVC, animated: true) } else { print("Cards") guard let cardDetailVC = self.storyboard?.instantiateViewController(identifier: "cardDetailVC") as? NewCardViewController else { print("cardDetailVC was not instantiated") return } cardDetailVC.selectedCard = filteredCards?[indexPath.row] print("cardDetailVC instantiated, with selectedCard", cardDetailVC.selectedCard) print("self.navigationController", self.navigationController) self.navigationController?.pushViewController(cardDetailVC, animated: true) } tableView.deselectRow(at: indexPath, animated: true) } }
Topic: UI Frameworks SubTopic: UIKit Tags:
Jul ’21
Reply to Segue from search results view controller to another view controller
Thanks for additional information. You notice that text is not formatted in comments, so I reformat here: Where is result row (a cell in which table) ? I suppose it is in the table of ResultsTableViewController ? Do I understand correctly that this table can contain either Decks or cards ?  Yep, right, results are cells in ResultsTableViewController, there might be decks or cards, depending on scope.  Is behaviour different for decks or cards, or is it the same "nothing happens" ?  Yes, for both nothing happens.  Did you check identifiers are effectively "cardsVC" and "cardDetailVC" (with same upper/lowercase) - Yes, I checked.  This is the output: navigation controller is nil, I also tried to embed ResultsTableViewController with navigation controller, but it didn't help.  print("didSelect scope", scope, "indexPath", indexPath) didSelect scope Optional("Decks") indexPath [0, 0] print("cardsVC instantiated, with selectedDeck", cardsVC.selectedDeck) print("self.parent?.navigationController", self.parent?.navigationController) Decks cardsVC instantiated, with selectedDeck Optional(Deck { _id = 60e98c5da7d8064df3298f68; name = Greetings; dateCreated = 2021-07-10 12:02:37 +0000; layout = frontToBack; autoplay = 0; cards = List <0x283afcfc0> ( [0] Card { _id = 60e98c63a7d8064df3298f6c; front = hello; back = ; dateCreated = 2021-07-10 12:02:43 +0000; audioName = (null); }, [1] Card { _id = 60e98c6aa7d8064df3298f6d; front = good evening; back = ; dateCreated = 2021-07-10 12:02:50 +0000; audioName = (null); } ); }) self.parent?.navigationController nil didSelect scope Optional("Cards") indexPath [0, 0] Cards cardDetailVC instantiated, with selectedCard Optional(Card { _id = 60e98c6aa7d8064df3298f6d; front = good evening; back = ; dateCreated = 2021-07-10 12:02:50 +0000; audioName = (null); }) self.navigationController nil Now the cause: ResultsTableViewController is not part of the navigation stack, hence its navigationController is nil. In fact, you instantiate directly: let resultsTableController = self.storyboard?.instantiateViewController(withIdentifier: "ResultsTableViewController") as! ResultsTableViewController You could try to add a property in class ResultsTableViewController: UITableViewController { var originatingController: DecksTableViewController? var filteredDecks: Results<Deck>? and set it when you create resultsTableController class DecksTableViewController: UITableViewController { private var searchController: UISearchController! private var decks: Results<Deck>!   override func viewDidLoad() {     super.viewDidLoad() tableView.tableFooterView = UIView() let resultsTableController = self.storyboard?.instantiateViewController(withIdentifier: "ResultsTableViewController") as! ResultsTableViewController resultsTableController?.originatingController = self configureSearchController(resultsTableController) Then call it as: self.originatingController?.navigationController?.pushViewController(cardsVC, animated: true) I could not test, but that should be the logic (may need some tuning though).
Topic: UI Frameworks SubTopic: UIKit Tags:
Jul ’21