Post

Replies

Boosts

Views

Activity

Reply to Refactoring withUnsafeMutableBytes
You can re-write it like this:     let result = randomIV.withUnsafeMutableBytes {(bufPointer: UnsafeMutableRawBufferPointer) in         SecRandomCopyBytes(kSecRandomDefault, bufPointer.count, bufPointer.baseAddress!)     } Or a little more simply:     let result = randomIV.withUnsafeMutableBytes {         SecRandomCopyBytes(kSecRandomDefault, $0.count, $0.baseAddress!)     }
Topic: Programming Languages SubTopic: Swift Tags:
Apr ’22
Reply to NaviagtionBar item doesn't appear
You should do it in a content view controller of the UINavigationController. SecondViewController.swift import UIKit class SecondViewController: UINavigationController { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .systemBackground self.viewControllers = [RootViewController()] } } RootViewController.swift import UIKit class RootViewController: UIViewController { override func viewDidLoad() { title = "Decount timers" super.viewDidLoad() view.backgroundColor = .systemBackground navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(didTapAddButton)) } @objc func didTapAddButton(_ sender: Any) { //... } }
Topic: UI Frameworks SubTopic: UIKit Tags:
Jan ’22
Reply to What is dynamic shared object (DSO) handle that #dsohandle applies to in Swift?
Searching with swift dsohandle, I can find a few discussions. https://twitter.com/chriseidhof/status/722352741767639040?lang=en https://github.com/apple/swift-log/issues/72 https://youtrack.jetbrains.com/issue/OC-14546 Estimating from the descriptions, dynamic shared object seems to be representing the dynamically linked libraries such as .dylib or .so currently running. It may be useful for the authors of libraries using dynamically linked libraries, where they can add a little more info for logging inside the libraries, but not so useful for usual developers just using the libraries.
Topic: Programming Languages SubTopic: Swift Tags:
Jan ’22
Reply to Failed to produce diagnostic for expression in SwiftUI, XCode 13.2
You should better include clear sentences explaining what you want to ask here. Have you come here to just report your bug? Or want to find a solution to fix the bug? Anyway, your code lacks one pair of parentheses at about 32nd line: VStack(alignment: .center, spacing: 10) { Text("Computers Choice: \(options[computersChoice].name)") .fontWeight(.bold) .padding //<- Image("\(options[computersChoice].name)") .resizable() .frame(width: 100, height: 100) .padding() Text("You need to \(winOrLose ? "Win" : "Lose")") .fontWeight(.bold) } So, you need to fill parentheses there: VStack(alignment: .center, spacing: 10) { Text("Computers Choice: \(options[computersChoice].name)") .fontWeight(.bold) .padding() //<- Image("\(options[computersChoice].name)") .resizable() .frame(width: 100, height: 100) .padding() Text("You need to \(winOrLose ? "Win" : "Lose")") .fontWeight(.bold) } Usual compilers can detect where this sort of simple syntax error is occurring, you can send a bug report to swift.org as suggested.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’22
Reply to Refactoring withUnsafeMutableBytes
You can re-write it like this:     let result = randomIV.withUnsafeMutableBytes {(bufPointer: UnsafeMutableRawBufferPointer) in         SecRandomCopyBytes(kSecRandomDefault, bufPointer.count, bufPointer.baseAddress!)     } Or a little more simply:     let result = randomIV.withUnsafeMutableBytes {         SecRandomCopyBytes(kSecRandomDefault, $0.count, $0.baseAddress!)     }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Apr ’22
Reply to SwiftUI quickLookPreview(_:) modifier doesn't work in iOS.
It seems the documentation is quite unclear, but you may need to import QuickLook to use the modifier quickLookPreview(_:).
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Apr ’22
Reply to Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
That depends on how you declare post.user.pic, and what sort of value it is holding. Please show enough code as text (not as image!) using Code Block.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to Escaping closure captures mutating 'self' parameter
That depends on other parts of your code. Please show enough code to solve the issue.
Replies
Boosts
Views
Activity
Jan ’22
Reply to NaviagtionBar item doesn't appear
You should do it in a content view controller of the UINavigationController. SecondViewController.swift import UIKit class SecondViewController: UINavigationController { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .systemBackground self.viewControllers = [RootViewController()] } } RootViewController.swift import UIKit class RootViewController: UIViewController { override func viewDidLoad() { title = "Decount timers" super.viewDidLoad() view.backgroundColor = .systemBackground navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(didTapAddButton)) } @objc func didTapAddButton(_ sender: Any) { //... } }
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to kivy iOS app deployment in Xcode (Build error)
Kivy is not a framework of Apple's. You should better visit the supporting site or a community site of it to get better answers sooner.
Replies
Boosts
Views
Activity
Jan ’22
Reply to Excel Visual Basic Editor does not open in Monterey
Whether or not it might be an issue related to M1 chip or Monterey security features, it is the responsibility of the author of the app to adapt it to work on M1 chip or Monterey. You will have a better chance to get answers on the sites related to Microsoft.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to Xcode Error 254 When Running Linux Executable File
When Xcode console shows Program ended with exit code: , the exit code is generated by the app you were running, not by Xcode. What is exit code 254 in your app? Does your app have any parts exit(254) (or possibly, exit(-2))? Google would not answer to the problem specific to your app.
Replies
Boosts
Views
Activity
Jan ’22
Reply to About background playback on Swift Playgrounds4
Please check this thread. To create an app which can play music in background, you need to create an app with Background Modes enabled for Audio. As for now, you cannot make it within an app project of Swift Playgrounds 4. You may need to do it with Xcode on a Mac.
Replies
Boosts
Views
Activity
Jan ’22
Reply to Swift Playgrounds 4 - GeoJson
Can you show your code?
Replies
Boosts
Views
Activity
Jan ’22
Reply to I can't preview my project
Can you show your code? (Not partially, the whole code. And not image, code as text using Code Block.)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to Mac Catalyst target does not build on M1 with this error: Could not read serialized diagnostics file: error("Invalid diagnostics signature")
As far as I experience till now, the error Could not read serialized diagnostics file is temporary. Please try Clean Build Folder, re-starting Xcode or re-starting your Mac and take sometime to see what happens next.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to What is dynamic shared object (DSO) handle that #dsohandle applies to in Swift?
Searching with swift dsohandle, I can find a few discussions. https://twitter.com/chriseidhof/status/722352741767639040?lang=en https://github.com/apple/swift-log/issues/72 https://youtrack.jetbrains.com/issue/OC-14546 Estimating from the descriptions, dynamic shared object seems to be representing the dynamically linked libraries such as .dylib or .so currently running. It may be useful for the authors of libraries using dynamically linked libraries, where they can add a little more info for logging inside the libraries, but not so useful for usual developers just using the libraries.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to How to get upload progress when using "await urlSession.upload()"
Something I need here maybe? Correct. Use self, if you implement urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:) in the same class. (Please do not forget to make the class conform to URLSessionTaskDelegate.)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to Failed to produce diagnostic for expression in SwiftUI, XCode 13.2
You should better include clear sentences explaining what you want to ask here. Have you come here to just report your bug? Or want to find a solution to fix the bug? Anyway, your code lacks one pair of parentheses at about 32nd line: VStack(alignment: .center, spacing: 10) { Text("Computers Choice: \(options[computersChoice].name)") .fontWeight(.bold) .padding //<- Image("\(options[computersChoice].name)") .resizable() .frame(width: 100, height: 100) .padding() Text("You need to \(winOrLose ? "Win" : "Lose")") .fontWeight(.bold) } So, you need to fill parentheses there: VStack(alignment: .center, spacing: 10) { Text("Computers Choice: \(options[computersChoice].name)") .fontWeight(.bold) .padding() //<- Image("\(options[computersChoice].name)") .resizable() .frame(width: 100, height: 100) .padding() Text("You need to \(winOrLose ? "Win" : "Lose")") .fontWeight(.bold) } Usual compilers can detect where this sort of simple syntax error is occurring, you can send a bug report to swift.org as suggested.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’22