Post

Replies

Boosts

Views

Activity

Reply to Date constant from year, month, day
Did you try this: func makeDate(year: Int, month: Int, day: Int, hr: Int = 0, min: Int = 0, sec: Int = 0) -> Date { var calendar = Calendar(identifier: .gregorian) calendar.timeZone = TimeZone(identifier: "GMT")! let components = DateComponents(year: year, month: month, day: day) //, hour: hr, minute: min, second: sec) return calendar.date(from: components)! } let myDate = makeDate(year: 2025, month: 02, day: 10) print(myDate)
Topic: App & System Services SubTopic: General Tags:
Feb ’25
Reply to Is it possible to get selected text from a Text field?
I tried with onChange, but could not extract the string: var body: some View { TextField("Placehodler", text: $myText, selection: $textSelection) .onChange(of: textSelection) { print("change of selection: \(textSelection)") } } I get change of selection: Optional(SwiftUI.TextSelection(indices: SwiftUI.TextSelection.Indices.selection(Range(Swift.String.Index(_rawBits: 131080)..<Swift.String.Index(_rawBits: 393224))), affinity: SwiftUI.TextSelectionAffinity.upstream)) But that leads nowhere. However, TextSelection doc hints at a way to extract strings, but does not show how to retrieve substrings: struct SuggestionTextEditor: View { @State var text: String = "" @State var selection: TextSelection? = nil var body: some View { VStack { TextEditor(text: $text, selection: $selection) // A helper view that offers live suggestions based on selection. SuggestionsView( substrings: getSubstrings(text: text, indices: selection?.indices)) } } private func getSubstrings( text: String, indices: TextSelection.Indices? ) -> [Substring] { // Resolve substrings representing the current selection... } } That let me hope there is a solution…
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’25
Reply to Swift Form on iOS
Welcome to the forum. Before one can answer, please: post complete code so that we can reproduce (not only the editSource func) format thee code with code formatter tool. As you can see, your present code is just unreadable.
Topic: Community SubTopic: Apple Developers Tags:
Feb ’25
Reply to Can you use emojis in your app description when releasing a new app version?
It is not forbidden for legal reasons, I think it is just an illicit character in the description field.
Replies
Boosts
Views
Activity
Feb ’25
Reply to Assistance Needed – Xcode: Command PhaseScriptExecution Failed with a Nonzero Exit Code
Please avoid to triplicate messages.
Replies
Boosts
Views
Activity
Feb ’25
Reply to Report a bug on Swift Playground, "Learn to Code 2" - "Seeking Seven Gems"
Thanks for the info. But bug should better be reported in FB Assistant https://feedbackassistant.apple.com
Replies
Boosts
Views
Activity
Feb ’25
Reply to Date constant from year, month, day
Did you try this: func makeDate(year: Int, month: Int, day: Int, hr: Int = 0, min: Int = 0, sec: Int = 0) -> Date { var calendar = Calendar(identifier: .gregorian) calendar.timeZone = TimeZone(identifier: "GMT")! let components = DateComponents(year: year, month: month, day: day) //, hour: hr, minute: min, second: sec) return calendar.date(from: components)! } let myDate = makeDate(year: 2025, month: 02, day: 10) print(myDate)
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Feb ’25
Reply to How to solve "Extra trailing closure passed in call" in a section?
Welcome to the forum. Hard to say with the code you show. Please post complete code of the View. The error may be elsewhere, like a missing or misplaced closing curly brace. Maybe there's a false note in the music. 😉
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Feb ’25
Reply to Guideline 4.3(a) - Design - Spam
Could you explain more clearly. Impossible to understand what you mean and what you want. is your app published already ? what was rejected as spam ? if you want a new version, just change the version release to version 2 or rename the app (it is possible) and then upload the new code.
Replies
Boosts
Views
Activity
Feb ’25
Reply to Swift Challenge
Welcome to the forum.   to join to developer programs you need to be under 18 years old Where did you read this ? That's absolutely not the case.
Replies
Boosts
Views
Activity
Feb ’25
Reply to Is it possible to get selected text from a Text field?
I tried with onChange, but could not extract the string: var body: some View { TextField("Placehodler", text: $myText, selection: $textSelection) .onChange(of: textSelection) { print("change of selection: \(textSelection)") } } I get change of selection: Optional(SwiftUI.TextSelection(indices: SwiftUI.TextSelection.Indices.selection(Range(Swift.String.Index(_rawBits: 131080)..<Swift.String.Index(_rawBits: 393224))), affinity: SwiftUI.TextSelectionAffinity.upstream)) But that leads nowhere. However, TextSelection doc hints at a way to extract strings, but does not show how to retrieve substrings: struct SuggestionTextEditor: View { @State var text: String = "" @State var selection: TextSelection? = nil var body: some View { VStack { TextEditor(text: $text, selection: $selection) // A helper view that offers live suggestions based on selection. SuggestionsView( substrings: getSubstrings(text: text, indices: selection?.indices)) } } private func getSubstrings( text: String, indices: TextSelection.Indices? ) -> [Substring] { // Resolve substrings representing the current selection... } } That let me hope there is a solution…
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’25
Reply to New to the Apple Developer Program
Start what ? To properly use the forum, start reading this: https://developer.apple.com/forums/thread/706527 To start programming ? You'll find a lot of material here in beginners' pathway: https://developer.apple.com/pathways/?cid=ht-pathways Wish you good start.
Replies
Boosts
Views
Activity
Feb ’25
Reply to WOW, These forums have improved a lot!
Welcome.to the forum. Great you like it. That's your first post ? How do you compare so to see the improvement ?
Replies
Boosts
Views
Activity
Feb ’25
Reply to User content required to college usage data?
You have to declare in App tracking transparency
Topic: Business & Education SubTopic: General Tags:
Replies
Boosts
Views
Activity
Feb ’25
Reply to copyright complaint
Are they more specific about copyright infringement reported by reviewer. It could be an image, a text, a music. What is your trademark about ? It is probably just a name of app or company, but reviewer may have detected something else.
Replies
Boosts
Views
Activity
Feb ’25
Reply to Swift Form on iOS
Welcome to the forum. Before one can answer, please: post complete code so that we can reproduce (not only the editSource func) format thee code with code formatter tool. As you can see, your present code is just unreadable.
Topic: Community SubTopic: Apple Developers Tags:
Replies
Boosts
Views
Activity
Feb ’25
Reply to labels appear as dimmed in UIView
OK, found the obvious answer: Label behaviour must be enabled ! But what does it really mean for a label to be enabled (user interaction being disabled…)
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Feb ’25
Reply to Is there a way to change the username on the developer forum ?
AFAIK, no way to change the user name. Unless by deleting the account and recreating. But that's too much extreme solution.
Replies
Boosts
Views
Activity
Feb ’25