I cannot find unwindFirstSegueFor anywhere in documentation.Where is this API defined ?
Post
Replies
Boosts
Views
Activity
I don't know what is exactly sole trader status.
Have you a registered company (likely if you have VAT number) ? If so, you can get a DUNS number.
Otherwise, you can publish on the appstore as an individual.
Topic:
Developer Tools & Services
SubTopic:
Apple Developer Program
Could you try to remove
updateSuggestionMenu()
showSuggestionMenu()
override func textDidChange(_ notification: Notification) {
super.textDidChange(notification)
print("Still typing")
// updateSuggestionMenu()
// showSuggestionMenu()
}
If the problem disappear, you should reset focus after
updateSuggestionMenu()
showSuggestionMenu()
Topic:
UI Frameworks
SubTopic:
AppKit
Tags:
The reply editor now expands to full width when you uncheck the Live Preview checkbox (r. 128882713).
Copying text no longer frames it as a quote (r. 128883038).
Great! That were 2 annoying bugs. Thanks
Topic:
Developer Tools & Services
SubTopic:
Developer Forums
Tags:
I just tested on iPhone 15 Plus simulator with iOS 17.4 and Xcode 15.3.
show Files folder in simulator
drag a file from Finder:
Save with the button on top right
That's it.
Topic:
Community
SubTopic:
Apple Developers
Tags:
Could you show your complete AppDelegate code ?
There is probably a problem here:
let typesArray = AppDelegate().typesArray
you create a new instance of AppDelegate (as AppDelegate() is a call to init to create a new instance), which itself has an empty typesArray as long as loadTypesArray has not been called. Hence let typesArray = returns empty array.
If typesArray is declared as static in AppDelegate, then you can call
in loadTypesArray:
AppDelegate.typesArray = plist // Need to refer to class because of static
Elsewhere:
let typesArray = AppDelegate.typesArray // No ()
Topic:
Programming Languages
SubTopic:
Swift
Tags:
I have not tried it, so I can't say if it works in your case.
You could try to use chartOverlay as described in doc, and use it to get in a State var where you tapped and then move to the view according to this known tap point.:
Chart(data) {
LineMark(
x: .value("date", $0.date),
y: .value("price", $0.price)
)
}
.chartOverlay { proxy in
GeometryReader { geometry in
Rectangle().fill(.clear).contentShape(Rectangle())
.gesture(
DragGesture()
.onChanged { value in
// Convert the gesture location to the coordinate space of the plot area.
let origin = geometry[proxy.plotAreaFrame].origin
let location = CGPoint(
x: value.location.x - origin.x,
y: value.location.y - origin.y
)
// Get the x (date) and y (price) value from the location.
let (date, price) = proxy.value(at: location, as: (Date, Double).self)
print("Location: \(date), \(price)")
}
)
}
}
Another tutorial here:
https://swiftwithmajid.com/2023/02/06/mastering-charts-in-swiftui-interactions/
Hope that can help.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
You need to receive the complete folder that contains Xcode project, not only the source files (otherwise, you'll have a significant work to rebuild the project).
The process should be:
unzip the zip file (just double click on the icon)
check that you get a folder containing a file such as MyProject.xcodeproj and a folder named MyProject (of course, you'll a name different than MyProject in both)
have xCode installed on your Mac
then double clicking on MyProject.xcodeproj will open the project in Xcode.
From there you can start modifying code and generate new spa file.
Topic:
Developer Tools & Services
SubTopic:
Apple Developer Program
Tags:
I understand it is not an issue with simulators but with device ? If that's the case, you should try to unpair the iPar and re-pair in Xcode.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
I tried to replicate, but I do get the rounded corners. Unless I did not understand the problem you describe.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
Thanks for the feedback. What did change in appearance (just for my understanding). And, no, I'm not in SwiftUI team, I wish I were, I would be much more knowledgable… Have a good day and good continuation.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
I may have found a simple solution.
Problem comes from List which manages interactions with rows on its own, creating the mess.
I just replaced List by a ScrollView, to get very similar display (except the ">" after button, but works OK for each link.
No need either for buttonStyle.
struct ContentView: View {
var body: some View {
NavigationView {
// List {
ScrollView {
ForEach(0..<10) { index in
HStack {
Spacer()
NavigationLink(destination: DestinationView1(item: index)) {
Text("Navigate to View 1")
.padding()
.background(Color.blue)
.foregroundColor(.white)
.cornerRadius(8)
}
// .buttonStyle(PlainButtonStyle()) // Not needed
Spacer()
NavigationLink(destination: DestinationView2(item: index)) {
Text("Navigate to View 2")
.padding()
.background(Color.green)
.foregroundColor(.white)
.cornerRadius(8)
}
// .buttonStyle(PlainButtonStyle()) // Not needed
Spacer()
}
.padding(.vertical, 5)
}
}
.navigationBarTitle("Navigation Links")
}
}
}
struct DestinationView1: View {
var item: Int
var body: some View {
Text("Destination View 1 for item \(item)")
.navigationBarTitle("View 1", displayMode: .inline)
}
}
struct DestinationView2: View {
var item: Int
var body: some View {
Text("Destination View 2 for item \(item)")
.navigationBarTitle("View 2", displayMode: .inline)
}
}
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
Picker label does not show except in some conditions. You have to find a work around to display the label independently.
Get details here: https://stackoverflow.com/questions/69381385/swiftui-custom-picker-label-not-rendering
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
It is really difficult and risky to try this way (and Chat GPT is not clever enough to find it 😉).
So, I would try to replace your navigation links by buttons and use ontapGesture to detect taps.
Some more help here: https://stackoverflow.com/questions/72917698/multiple-navigation-destinations-from-a-list-row-in-swiftui
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
I do not declare a new State var but an AppStorage…
Maybe the State var is to know you have saved and then disable Save Button.
Declare this:
@AppStorage("Names") var storedNames: String = ""
Then, in the Save, we concatenate all the names.
Note: AppStorage saves in UserDefaults. But it cannot save directly and array, so we transform the array of String into a String, by concatenation.
In Load, we de concatenate.
You will see how fun on arrays, as reduce, split and map are really powerful here.
If you don't know them, learn by reading documentation. It is really important to understand how they work
So the complete code:
struct ContentView: View {
@State private var names: [String] = []
@State private var nameToAdd = ""
@State private var pickedName = ""
@State private var shouldRemovePickedName = false
@AppStorage("Names") var storedNames: String = "" // The concatenation of all the names, separated by commas
var body: some View {
VStack {
VStack(spacing: 8) {
Image(systemName: "person.3.sequence.fill")
.foregroundStyle(.tint)
.symbolRenderingMode(.hierarchical)
Text("Pick-a-Pal")
}
.font(.title)
.bold()
//3項条件演算子
Text(pickedName.isEmpty ? "" : pickedName)
.font(.title2)
.bold()
.foregroundStyle(.tint)
List {
ForEach(names, id: \.self) { name in
Text(name)
}
}
.clipShape(RoundedRectangle(cornerRadius: 8))
TextField("Add Name", text: $nameToAdd)
//単語の自動修正をオフにする
.autocorrectionDisabled()
.onSubmit {
if !nameToAdd.isEmpty {
if names.contains(nameToAdd) {
// You could add an alert, or sound a beep if already exists
} else {
names.append(nameToAdd)
}
nameToAdd = ""
}
}
Divider()
Toggle("Remove when picked", isOn: $shouldRemovePickedName)
Button {
if let randomName = names.randomElement() {
pickedName = randomName
if shouldRemovePickedName {
names.removeAll() { name in
return (name == randomName)
}
}
} else {
pickedName = ""
}
} label: {
Text("Pick Random Name")
.padding(.vertical, 8)
.padding(.horizontal, 16)
}
.buttonStyle(.borderedProminent)
.font(.title2)
Divider()
HStack { // Show 2 buttons on HStack
Button {
// We concatenate the names ; reduce func is useful for this
storedNames = names.reduce("", { $0 + $1 + "," }) // Comma to separate next name
// A more readable equivalent is:
// storedNames = names.reduce("", { concatenate, name in concatenate + name + "," })
print(storedNames)
} label: {
Text("Save Names")
}
Spacer(minLength: 40)
Button {
// We need to de-concatenate: split function splits the elements in a string into an array, dividing by the separator
names = storedNames.split(separator: ",").map( { String($0) }) // as split returns an array of subtrings, we need to map into String
print(names) // To see what we get
} label: {
Text("Load saved Names")
}
}
}
.padding()
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
I cannot find unwindFirstSegueFor anywhere in documentation.Where is this API defined ?
- Replies
- Boosts
- Views
- Activity
I don't know what is exactly sole trader status.
Have you a registered company (likely if you have VAT number) ? If so, you can get a DUNS number.
Otherwise, you can publish on the appstore as an individual.
Topic:
Developer Tools & Services
SubTopic:
Apple Developer Program
- Replies
- Boosts
- Views
- Activity
Could you try to remove
updateSuggestionMenu()
showSuggestionMenu()
override func textDidChange(_ notification: Notification) {
super.textDidChange(notification)
print("Still typing")
// updateSuggestionMenu()
// showSuggestionMenu()
}
If the problem disappear, you should reset focus after
updateSuggestionMenu()
showSuggestionMenu()
Topic:
UI Frameworks
SubTopic:
AppKit
Tags:
- Replies
- Boosts
- Views
- Activity
The reply editor now expands to full width when you uncheck the Live Preview checkbox (r. 128882713).
Copying text no longer frames it as a quote (r. 128883038).
Great! That were 2 annoying bugs. Thanks
Topic:
Developer Tools & Services
SubTopic:
Developer Forums
Tags:
- Replies
- Boosts
- Views
- Activity
I just tested on iPhone 15 Plus simulator with iOS 17.4 and Xcode 15.3.
show Files folder in simulator
drag a file from Finder:
Save with the button on top right
That's it.
Topic:
Community
SubTopic:
Apple Developers
Tags:
- Replies
- Boosts
- Views
- Activity
Could you show your complete AppDelegate code ?
There is probably a problem here:
let typesArray = AppDelegate().typesArray
you create a new instance of AppDelegate (as AppDelegate() is a call to init to create a new instance), which itself has an empty typesArray as long as loadTypesArray has not been called. Hence let typesArray = returns empty array.
If typesArray is declared as static in AppDelegate, then you can call
in loadTypesArray:
AppDelegate.typesArray = plist // Need to refer to class because of static
Elsewhere:
let typesArray = AppDelegate.typesArray // No ()
Topic:
Programming Languages
SubTopic:
Swift
Tags:
- Replies
- Boosts
- Views
- Activity
I have not tried it, so I can't say if it works in your case.
You could try to use chartOverlay as described in doc, and use it to get in a State var where you tapped and then move to the view according to this known tap point.:
Chart(data) {
LineMark(
x: .value("date", $0.date),
y: .value("price", $0.price)
)
}
.chartOverlay { proxy in
GeometryReader { geometry in
Rectangle().fill(.clear).contentShape(Rectangle())
.gesture(
DragGesture()
.onChanged { value in
// Convert the gesture location to the coordinate space of the plot area.
let origin = geometry[proxy.plotAreaFrame].origin
let location = CGPoint(
x: value.location.x - origin.x,
y: value.location.y - origin.y
)
// Get the x (date) and y (price) value from the location.
let (date, price) = proxy.value(at: location, as: (Date, Double).self)
print("Location: \(date), \(price)")
}
)
}
}
Another tutorial here:
https://swiftwithmajid.com/2023/02/06/mastering-charts-in-swiftui-interactions/
Hope that can help.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
- Replies
- Boosts
- Views
- Activity
You need to receive the complete folder that contains Xcode project, not only the source files (otherwise, you'll have a significant work to rebuild the project).
The process should be:
unzip the zip file (just double click on the icon)
check that you get a folder containing a file such as MyProject.xcodeproj and a folder named MyProject (of course, you'll a name different than MyProject in both)
have xCode installed on your Mac
then double clicking on MyProject.xcodeproj will open the project in Xcode.
From there you can start modifying code and generate new spa file.
Topic:
Developer Tools & Services
SubTopic:
Apple Developer Program
Tags:
- Replies
- Boosts
- Views
- Activity
I understand it is not an issue with simulators but with device ? If that's the case, you should try to unpair the iPar and re-pair in Xcode.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
- Replies
- Boosts
- Views
- Activity
I tried to replicate, but I do get the rounded corners. Unless I did not understand the problem you describe.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
- Replies
- Boosts
- Views
- Activity
Thanks for the feedback. What did change in appearance (just for my understanding). And, no, I'm not in SwiftUI team, I wish I were, I would be much more knowledgable… Have a good day and good continuation.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
- Replies
- Boosts
- Views
- Activity
I may have found a simple solution.
Problem comes from List which manages interactions with rows on its own, creating the mess.
I just replaced List by a ScrollView, to get very similar display (except the ">" after button, but works OK for each link.
No need either for buttonStyle.
struct ContentView: View {
var body: some View {
NavigationView {
// List {
ScrollView {
ForEach(0..<10) { index in
HStack {
Spacer()
NavigationLink(destination: DestinationView1(item: index)) {
Text("Navigate to View 1")
.padding()
.background(Color.blue)
.foregroundColor(.white)
.cornerRadius(8)
}
// .buttonStyle(PlainButtonStyle()) // Not needed
Spacer()
NavigationLink(destination: DestinationView2(item: index)) {
Text("Navigate to View 2")
.padding()
.background(Color.green)
.foregroundColor(.white)
.cornerRadius(8)
}
// .buttonStyle(PlainButtonStyle()) // Not needed
Spacer()
}
.padding(.vertical, 5)
}
}
.navigationBarTitle("Navigation Links")
}
}
}
struct DestinationView1: View {
var item: Int
var body: some View {
Text("Destination View 1 for item \(item)")
.navigationBarTitle("View 1", displayMode: .inline)
}
}
struct DestinationView2: View {
var item: Int
var body: some View {
Text("Destination View 2 for item \(item)")
.navigationBarTitle("View 2", displayMode: .inline)
}
}
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
- Replies
- Boosts
- Views
- Activity
Picker label does not show except in some conditions. You have to find a work around to display the label independently.
Get details here: https://stackoverflow.com/questions/69381385/swiftui-custom-picker-label-not-rendering
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
- Replies
- Boosts
- Views
- Activity
It is really difficult and risky to try this way (and Chat GPT is not clever enough to find it 😉).
So, I would try to replace your navigation links by buttons and use ontapGesture to detect taps.
Some more help here: https://stackoverflow.com/questions/72917698/multiple-navigation-destinations-from-a-list-row-in-swiftui
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
- Replies
- Boosts
- Views
- Activity
I do not declare a new State var but an AppStorage…
Maybe the State var is to know you have saved and then disable Save Button.
Declare this:
@AppStorage("Names") var storedNames: String = ""
Then, in the Save, we concatenate all the names.
Note: AppStorage saves in UserDefaults. But it cannot save directly and array, so we transform the array of String into a String, by concatenation.
In Load, we de concatenate.
You will see how fun on arrays, as reduce, split and map are really powerful here.
If you don't know them, learn by reading documentation. It is really important to understand how they work
So the complete code:
struct ContentView: View {
@State private var names: [String] = []
@State private var nameToAdd = ""
@State private var pickedName = ""
@State private var shouldRemovePickedName = false
@AppStorage("Names") var storedNames: String = "" // The concatenation of all the names, separated by commas
var body: some View {
VStack {
VStack(spacing: 8) {
Image(systemName: "person.3.sequence.fill")
.foregroundStyle(.tint)
.symbolRenderingMode(.hierarchical)
Text("Pick-a-Pal")
}
.font(.title)
.bold()
//3項条件演算子
Text(pickedName.isEmpty ? "" : pickedName)
.font(.title2)
.bold()
.foregroundStyle(.tint)
List {
ForEach(names, id: \.self) { name in
Text(name)
}
}
.clipShape(RoundedRectangle(cornerRadius: 8))
TextField("Add Name", text: $nameToAdd)
//単語の自動修正をオフにする
.autocorrectionDisabled()
.onSubmit {
if !nameToAdd.isEmpty {
if names.contains(nameToAdd) {
// You could add an alert, or sound a beep if already exists
} else {
names.append(nameToAdd)
}
nameToAdd = ""
}
}
Divider()
Toggle("Remove when picked", isOn: $shouldRemovePickedName)
Button {
if let randomName = names.randomElement() {
pickedName = randomName
if shouldRemovePickedName {
names.removeAll() { name in
return (name == randomName)
}
}
} else {
pickedName = ""
}
} label: {
Text("Pick Random Name")
.padding(.vertical, 8)
.padding(.horizontal, 16)
}
.buttonStyle(.borderedProminent)
.font(.title2)
Divider()
HStack { // Show 2 buttons on HStack
Button {
// We concatenate the names ; reduce func is useful for this
storedNames = names.reduce("", { $0 + $1 + "," }) // Comma to separate next name
// A more readable equivalent is:
// storedNames = names.reduce("", { concatenate, name in concatenate + name + "," })
print(storedNames)
} label: {
Text("Save Names")
}
Spacer(minLength: 40)
Button {
// We need to de-concatenate: split function splits the elements in a string into an array, dividing by the separator
names = storedNames.split(separator: ",").map( { String($0) }) // as split returns an array of subtrings, we need to map into String
print(names) // To see what we get
} label: {
Text("Load saved Names")
}
}
}
.padding()
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
- Replies
- Boosts
- Views
- Activity