Post

Replies

Boosts

Views

Activity

Reply to Required content for platform tvOS simulator is missing. Please reinstall Xcode.
My internet connection is slow. I don't want to download 11 GB Xcode. Could someone help me? Better find a good place where you can use broadband internet. The recent Xcode works with tight communications with Apple's servers. You will meet many other messages and cannot run or distribute your app unless you do things in the right way. Generally, installing Xcode through More Download pages - https://developer.apple.com/download/more/ may work in a little less stable communications environment, but you need to download 11GB Xcode and many more hidden components.
May ’21
Reply to Page Switching
Writing an initialization code of Views in Button actions does not make sense. Write a code to show other views using NavigationLink or sheet or something else, and change the @State variable for it.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’21
Reply to iPhone IDE
maybe someone can think about developing one. Unfortunately, there are many agreements or contracts between Apple and us developers. So, most developers believe that third party developers cannot develop a fully functional IDE on iPhone or iPad. You can write a feature request to Apple using the Feedback Assistant - https://developer.apple.com/bug-reporting/. You may already know and may not think it as a fully functional development tool, but Swift Playgrounds is a good tool to learn programming in Swift.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’21
Reply to Configuring MIDiSysexSendRequest (Data types)
MIDICompletionProc is a typealias of a closure type, as shown in the doc - https://developer.apple.com/documentation/coremidi/midicompletionproc. typealias MIDICompletionProc = (UnsafeMutablePointerMIDISysexSendRequest) - Void You may need to pass a global function or a closure of @convention(c). completionRefCon is any type of pointer which points to some stable address while MIDI process is running. Or it can be nil. So, for example, you can write something like this: // Define a global function, somewhere outside any classes func handleMIDISysexSendRequestCompletion(_ request: UnsafeMutablePointerMIDISysexSendRequest) { //... } class SomeClass { //... func someFunc(...) { //... var request = MIDISysexSendRequest( destination: endPoint, data: dataPointer, bytesToSend: dataSize, complete: isComplete, reserved: (0,0,0), completionProc: handleMIDISysexSendRequestCompletion, completionRefCon: nil ) let result = MIDISendSysex(&request) print(result) //... } }
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to Why is this crashing?
However, the part with the if runs before it can be purchased Please clarify: Where is the part with the if? When is the time it can be purchased? In my opinion, your code is too complex than it should be so just showing the code does not explain enough.
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to Why is this crashing?
Would you like me to give you my project so you can run it? Thank you for your proposal, but as far as I see the code you have already shown, the whole project would not clarify what I want to know. The if I am talking about is on line 15 and it is supposed to prompt to get purchased if not purchased already If you say the if on line 15 is not working as you expect, why are you setting setIconPurchased to true before it is ready?
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to Fatal error: Index out of range. In for loop using an array.
With this line: var randomSeq: [Int] = [] You initialize randomSeq with a zero-length Array. So, any index including 0 would cause Index out of range. In Swift, accessing an Array with subscript does not automatically extend the Array, and may cause Index out of range. I guess, you may need to write something like this: import Foundation let maxLevel: Int = 99 var randomSeq: [Int] = [] struct NumGen { static func generate() { //randomSeq.removeAll() for i in 1...maxLevel { randomSeq.append(Int.random(in: 1...4)) print(i) } } }
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to Required content for platform tvOS simulator is missing. Please reinstall Xcode.
My internet connection is slow. I don't want to download 11 GB Xcode. Could someone help me? Better find a good place where you can use broadband internet. The recent Xcode works with tight communications with Apple's servers. You will meet many other messages and cannot run or distribute your app unless you do things in the right way. Generally, installing Xcode through More Download pages - https://developer.apple.com/download/more/ may work in a little less stable communications environment, but you need to download 11GB Xcode and many more hidden components.
Replies
Boosts
Views
Activity
May ’21
Reply to Page Switching
Writing an initialization code of Views in Button actions does not make sense. Write a code to show other views using NavigationLink or sheet or something else, and change the @State variable for it.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Xcode Storyboard - how to seamlessly change from one scene to another
(Sorry, I was missing the word macOS.) You can find some old threads for macOS. Some examples: https://developer.apple.com/forums/thread/14485 Or https://stackoverflow.com/questions/28139294/how-does-one-display-a-new-view-controller-in-the-same-mac-window Can't you find anything useful in any of them?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Xcode last version bug with Iphone 14.5.1
Have you tried installing the latest Xcode (12.5) from the More Downloads page - https://developer.apple.com/download/more/?
Replies
Boosts
Views
Activity
May ’21
Reply to iPhone IDE
maybe someone can think about developing one. Unfortunately, there are many agreements or contracts between Apple and us developers. So, most developers believe that third party developers cannot develop a fully functional IDE on iPhone or iPad. You can write a feature request to Apple using the Feedback Assistant - https://developer.apple.com/bug-reporting/. You may already know and may not think it as a fully functional development tool, but Swift Playgrounds is a good tool to learn programming in Swift.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Configuring MIDiSysexSendRequest (Data types)
MIDICompletionProc is a typealias of a closure type, as shown in the doc - https://developer.apple.com/documentation/coremidi/midicompletionproc. typealias MIDICompletionProc = (UnsafeMutablePointerMIDISysexSendRequest) - Void You may need to pass a global function or a closure of @convention(c). completionRefCon is any type of pointer which points to some stable address while MIDI process is running. Or it can be nil. So, for example, you can write something like this: // Define a global function, somewhere outside any classes func handleMIDISysexSendRequestCompletion(_ request: UnsafeMutablePointerMIDISysexSendRequest) { //... } class SomeClass { //... func someFunc(...) { //... var request = MIDISysexSendRequest( destination: endPoint, data: dataPointer, bytesToSend: dataSize, complete: isComplete, reserved: (0,0,0), completionProc: handleMIDISysexSendRequestCompletion, completionRefCon: nil ) let result = MIDISendSysex(&request) print(result) //... } }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Objective C protocol implementation in Swift
Please show the definition of the protocol Handler, and show the precise code to represent what you did. With shown a code with bunch of syntax errors, it is hard to say what's causing the issue. And please do not forget to use Code block (icon ``) of this site when showing some code.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Why is this crashing?
Ok, but I am still wondering about how to get the things to trigger if setIconPurchased = true Maybe you need to clarify when you expect setIconPurchased gets true and when if setIconPurchased is executed.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Why is this crashing?
However, the part with the if runs before it can be purchased Please clarify: Where is the part with the if? When is the time it can be purchased? In my opinion, your code is too complex than it should be so just showing the code does not explain enough.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Why is this crashing?
Would you like me to give you my project so you can run it? Thank you for your proposal, but as far as I see the code you have already shown, the whole project would not clarify what I want to know. The if I am talking about is on line 15 and it is supposed to prompt to get purchased if not purchased already If you say the if on line 15 is not working as you expect, why are you setting setIconPurchased to true before it is ready?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Why is this crashing?
Once an icon gets purchased, setIconPurchased gets set to true, and then if it equals true it does more actions. Then your code is quite right. Please go on with your current code.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Fatal error: Index out of range. In for loop using an array.
With this line: var randomSeq: [Int] = [] You initialize randomSeq with a zero-length Array. So, any index including 0 would cause Index out of range. In Swift, accessing an Array with subscript does not automatically extend the Array, and may cause Index out of range. I guess, you may need to write something like this: import Foundation let maxLevel: Int = 99 var randomSeq: [Int] = [] struct NumGen { static func generate() { //randomSeq.removeAll() for i in 1...maxLevel { randomSeq.append(Int.random(in: 1...4)) print(i) } } }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to MKPolyline 'inside' an MKOverlay: How do I access the points that construct the line?
Can you show your example kml?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to MKPolyline 'inside' an MKOverlay: How do I access the points that construct the line?
Thanks, I could have downloaded the xml file. A bit long, but can you try this? po overlays.map {$0 as! MKPolyline}.map {Array(UnsafeBufferPointer(start:$0.points(),count:$0.pointCount))}
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to MKPolyline 'inside' an MKOverlay: How do I access the points that construct the line?
the numbers below are much much larger?  MKPolyline converts CLLocationCoordinate2D (which holds latitudes and longitudes) into MKMapPoint. I am not sure if the shown values are too large or sort of invalid as MKMapPoint.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21