Post

Replies

Boosts

Views

Activity

Reply to Swift can't find the Entity Core Data
I was wrong. As OOPer explained, If you option-click on ToDoCD, you should be sent to ToDoCD class definition. // // ToDoCD+CoreDataClass.swift // ToDoCD // // Created by Claude31 on 22/08/2021. // // This file was automatically generated and should not be edited. // import Foundation import CoreData @objc(ToDoCD) public class ToDoCD: NSManagedObject { }
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’21
Reply to slots to hangman game
how to generates the slots for each letter in the word What is the exact problem ? Is it to create the display or to put letters ? What you could do: create a label for each letter (you have to create as many as there are letters in word). So the best is to create an IBOutletCollection @IBOutlet var letters: [UILabel]! Because the number of letters may vary, you may choose to create the labels in code: var nbLetters : Int // You should ask player to tell how many for i in 0..<nbLetters { // create UILabels let label = UILabel(frame: CGRect(x: 20 * (i + 1), y: 50, width: 20, height: 21)) // You will set the x, y position as needed label.textAlignment = .center label.text = "_" // When there is no text letters.append(label) self.view.addSubview(label) } You could also decide in your game that words will be 10 letters max (for instance), and then create the 10 labels in storyboard, connect to the IBOutletCollection. Then when you select a word, you will hide the non needed labels. When you play, you put the letter where it fits (in the correct index of letters). For instance if T is in second (position 1 in array) letters[1].text = "T" Hope that will let you start. Start coding and come back if you have other problem. Sorry, I just notice it is SwiftUI ? What I described was for UIKit. In SwiftUI, you should create a Stack of Text for the letters.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’21
Reply to iOS UIAlertController Line separator missing in iPhone 12, iOS 15
I cannot replicate the problem. I tested in: Xcode 13ß5 iPhone 12 ProMax simulator with iOS 15.0 I get the line: Code (Swift) as follows: @IBAction func goToNotice(_ sender: UIButton) { let alert = UIAlertController(title: "Go to Notice 💙", message: "after alert", preferredStyle: .alert) alert.addAction(UIAlertAction( title: "OK", style: UIAlertAction.Style.default, handler: { _ in DispatchQueue.main.async { if let passDataVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "NoticeViewID") as? NoticeScrollViewController { self.present(passDataVC, animated: true, completion: nil) } } })) self.present(alert, animated: true, completion: { print("Favourite button Pressed") } ) }
Topic: UI Frameworks SubTopic: UIKit Tags:
Aug ’21
Reply to Don’t show names of the calling contact
This is not an Apple contact channel. What do you expect developers here to do for you ? So, use "Contact Us" in Support section at bottom of this page. Did you try to reboot the iPhone ? Did you search on the web ? I found this: h t t p s : / / osxdaily.com/2020/02/09/contacts-showing-phone-numbers-without-names-iphone-fix/
Topic: App & System Services SubTopic: Core OS Tags:
Aug ’21
Reply to App increases size even if I delete data (Core Data)
when I delete data, the size of the app remains unchanged and sometimes increases, AFAIK, deleting data does not mean that you purge the space and compact the database. You should probably have to recreate the database completely, just keeping existing records. In any case, does this cause you problem or is this for understanding ? Note: may be interested in reading this: https://stackoverflow.com/questions/64677236/how-to-check-the-size-of-coredata-in-swift
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’21
Reply to Fetch Core Data Issue
Whenever I click save it prints 1 more object then I already have regardless of how many favourites there are. Isn't it what you expect to have one more object ? I don't really understand your comment here. if I have 53704 saved objects then after I click save I have 53705 it seems to always be over 40000. What is the real number of objects you should have ?
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’21
Reply to How do I swap views in a single window?
Hiding views is the easiest to implement. The views would all be active all the time, just hidden. What's the problem here ? But there are many other solutions, it depends what you want precisely. You could use PageView and swipe between them: https://developer.apple.com/documentation/appkit/nspagecontroller create collectionView, with cell of exact size of the full view : h t t p s : / / w w w.appcoda.com/macos-programming-collection-view/ use splitView to have the list of pages in Master on the left and content on the detailView on the right. Once again, it depends on what user experience you want to provide.
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’21
Reply to Swift can't find the Entity Core Data
I'm not really fluent in CoreData, but I think you should declare a struct: struct ToDoCD { var name: String var priority: Int32 }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Swift can't find the Entity Core Data
I was wrong. As OOPer explained, If you option-click on ToDoCD, you should be sent to ToDoCD class definition. // // ToDoCD+CoreDataClass.swift // ToDoCD // // Created by Claude31 on 22/08/2021. // // This file was automatically generated and should not be edited. // import Foundation import CoreData @objc(ToDoCD) public class ToDoCD: NSManagedObject { }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to slots to hangman game
how to generates the slots for each letter in the word What is the exact problem ? Is it to create the display or to put letters ? What you could do: create a label for each letter (you have to create as many as there are letters in word). So the best is to create an IBOutletCollection @IBOutlet var letters: [UILabel]! Because the number of letters may vary, you may choose to create the labels in code: var nbLetters : Int // You should ask player to tell how many for i in 0..<nbLetters { // create UILabels let label = UILabel(frame: CGRect(x: 20 * (i + 1), y: 50, width: 20, height: 21)) // You will set the x, y position as needed label.textAlignment = .center label.text = "_" // When there is no text letters.append(label) self.view.addSubview(label) } You could also decide in your game that words will be 10 letters max (for instance), and then create the 10 labels in storyboard, connect to the IBOutletCollection. Then when you select a word, you will hide the non needed labels. When you play, you put the letter where it fits (in the correct index of letters). For instance if T is in second (position 1 in array) letters[1].text = "T" Hope that will let you start. Start coding and come back if you have other problem. Sorry, I just notice it is SwiftUI ? What I described was for UIKit. In SwiftUI, you should create a Stack of Text for the letters.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Mac Display is Black/Not Working post the Big Sur Update
Just some ideas: Did you monitor the update to big Sur ? Did it complete correctly ? When you checked last time, was it after update ? Have you a possibility to connect to an external monitor (to see if the problem is a hardware issue or a soft issue) ?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to How do I swap views in a single window?
Why don't you create the 3 views in IB (A, B, C) Hide all but one (A for instance) to switch to another view (C for instance), hide A and unhide C
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Can swift be more like this?
@unidef what would be the purpose ? Where is it inspired from ?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to iOS UIAlertController Line separator missing in iPhone 12, iOS 15
I cannot replicate the problem. I tested in: Xcode 13ß5 iPhone 12 ProMax simulator with iOS 15.0 I get the line: Code (Swift) as follows: @IBAction func goToNotice(_ sender: UIButton) { let alert = UIAlertController(title: "Go to Notice 💙", message: "after alert", preferredStyle: .alert) alert.addAction(UIAlertAction( title: "OK", style: UIAlertAction.Style.default, handler: { _ in DispatchQueue.main.async { if let passDataVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "NoticeViewID") as? NoticeScrollViewController { self.present(passDataVC, animated: true, completion: nil) } } })) self.present(alert, animated: true, completion: { print("Favourite button Pressed") } ) }
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Don’t show names of the calling contact
This is not an Apple contact channel. What do you expect developers here to do for you ? So, use "Contact Us" in Support section at bottom of this page. Did you try to reboot the iPhone ? Did you search on the web ? I found this: h t t p s : / / osxdaily.com/2020/02/09/contacts-showing-phone-numbers-without-names-iphone-fix/
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to New tag …PWA
Just file a bug report for Improvement in the FeedBack assistant. Could be named progressive Web (to be looking the same as Safari and Web).
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to App increases size even if I delete data (Core Data)
when I delete data, the size of the app remains unchanged and sometimes increases, AFAIK, deleting data does not mean that you purge the space and compact the database. You should probably have to recreate the database completely, just keeping existing records. In any case, does this cause you problem or is this for understanding ? Note: may be interested in reading this: https://stackoverflow.com/questions/64677236/how-to-check-the-size-of-coredata-in-swift
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Swift Concurrency (async let) - Cancellation
Why do you expect A to be cancelled ? A and B run each in their thread, no one expecting from the other, just c is awaiting and throws error, but A remains untouched.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Can swift be more like this?
Thanks for the clarification.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Fetch Core Data Issue
Whenever I click save it prints 1 more object then I already have regardless of how many favourites there are. Isn't it what you expect to have one more object ? I don't really understand your comment here. if I have 53704 saved objects then after I click save I have 53705 it seems to always be over 40000. What is the real number of objects you should have ?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to How do I swap views in a single window?
Hiding views is the easiest to implement. The views would all be active all the time, just hidden. What's the problem here ? But there are many other solutions, it depends what you want precisely. You could use PageView and swipe between them: https://developer.apple.com/documentation/appkit/nspagecontroller create collectionView, with cell of exact size of the full view : h t t p s : / / w w w.appcoda.com/macos-programming-collection-view/ use splitView to have the list of pages in Master on the left and content on the detailView on the right. Once again, it depends on what user experience you want to provide.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Rearrange pdf Document in Swift in iOS app
Well, I will just recreate a new pdf, picking pages in the order I need.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21