Post

Replies

Boosts

Views

Activity

Reply to .navigationViewStyle(.columns) doesn't work
Can you clarify what you mean by fixed Navigation View? Anyway, you may need to define at least two columns inside NavigationView to test how .columns work. A simple example: struct CollectionView: View { var body: some View { if #available(iOS 15.0, *) { NavigationView { //First column VStack { NavigationLink(destination: //Second column replacement Text("Hello") .navigationBarTitle("Hello") ) { Text("To hello") } } .navigationBarTitle("List", displayMode: .large) //Second column EmptyView() } .navigationViewStyle(.columns) } else { // Fallback on earlier versions } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’21
Reply to What app type should I select from the Xcode platform ?
Every Apple's platform have URLSession available. If you just want to explore how to use URLSession, create an iOS App project/Storyboard and add a new method into ViewController. import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. //Call `testURLSession()` here. testURLSession() print("testURLSession() called") } func testURLSession() { //Write code using `URLSession` here... //... } }
Oct ’21
Reply to wrong date
When you show your code, please use the code block? What is wrong with 2000-01-01 08:55:00 +0000? What is wrong with 2018-10-14 03:56:23? And what are the expected outputs?
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’21
Reply to Multiple Xcode versions on My Mac
would installing a lower version of Xcode take up just as much space on my hard dive as the current version I already have installed? YES. can I install the lower version on an external hard drive? NO. Xcode needs to be installed on a start up disk. I haven't tried with Apple Silicon Macs, but I do not expect this restriction would have changed. can having multiple Xcode versions installed cause unexpected behavior?  I have installed Xcode 13 as Xcode.app from Mac App Store and Xcode 12.5.1 as Xcode12.5.1.app from More Downloads page. Using both of them for 3 weeks or more, I have not met any severe things yet. How can I make this process in a safe and optimized way?  Just download the other version of Xcode from More Downloads page, expand it there, rename Xcode.app to an appropriate name (before opening it!) and then move it to Applications folder. That's all. Just try.
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’21
Reply to Is there a planned end of life for Rosetta 2?
Is there any official timeline for the deprecation of Rosetta 2 for ARM based Macs? NO, not yet. You should better check the announcements of Apple by yourself. News and Updates But Apple might give us developers only a few months (or less!) till actual removal of some functionalities when announced. (And some sorts of functionalities might be removed silently and abruptly.) You should better prepare now.
Topic: App & System Services SubTopic: Core OS Tags:
Oct ’21
Reply to Image Literal
I'm following a tutorial and the image literal function auto-populated on the tutorial Image literal is not a thing you type manually. If your tutorial has any parts typing ImageLiteral into a code editor, you should better not rely on the description. Image literals are intended to be automatically generated by Xcode. After you have successfully added an image resource to your project, you can drag the image from the Project navigator to an actual position in the code editor: The detailed behavior may be different in versions of Xcode. Your question is about how to use Xcode and you should better include the version info in your original post. And better use the tag Xcode.
Oct ’21
Reply to How Do You Assign Int To UILabel
When you show your code, please show it as text using Code Block. With showing easily testable code, more readers would try to solve your issue. And in Swift, only type names start with Capital letter. Score or ScoreButton are not Swifty names. And one more, if TestViewController is actually a subclass of ViewController, it might not be appropriate to instantiate it like TestViewController(). This may cause many critical issues. We need to guess some parts of your code (you are not showing how score of TestViewController is declared), but according to the error message, you may need to write something like this: Score.text = String(newScore.score) When you want to change the content text shown in a UILabel, you need to change the property text, not UILabel itself. And, Swift is a strictly typed language. When newScore.score is Int, you need to convert it to String explicitly. Using String.init(_:) is one way to convert Int to String.
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’21