The method url(forResource:withExtension:) can be called like this:
let url = Bundle.module.url(forResource: "foo", withExtension: "txt")!
or like this:
let url = Bundle.module.url(forResource: "foo.txt", withExtension: nil)!
Both ways seems to work.
Are there any differences between the two?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Following the examples from the official documentation: https://developer.apple.com/documentation/swiftui/adding-a-search-interface-to-your-app
When the user types in the text in the search field, the list is updated with filtered results. How do I cause these changes to be animated?
I tired to put .animated() after the .searchable modifier, the result was what I am looking for, however it also broke the animation of the search field getting/releasing focus.
I was not able to find info regarding this situation in the official docs.
What will happen if a version was not yet released to all, and a new version is phased released?
For example if I am phased releasing version 2.0. On day 3, when only 5% of the users have this version, I discovered that this version has a bug. I paused the release of 2.0 and created a hotfix version 2.1.
What will happen all the users who did not receive 2.0 when I start phased release of 2.1? Will they get an immediate update to 2.0 or will they skip this version?
I opened a feedback ticket (FB16508762) but maybe someone in the community already found a workaround while the feedback reaches the maintainers.
When I put a Button inside a ScrollView, the tap animation stops working reliably and works only when the user taps and holds the button for a short time. The reasons, I believe is related to the fact that isPressed of configuration does not change and the default button styles use it to animate the tap.
import SwiftUI
struct DebuggingButtonStyle: ButtonStyle {
func makeBody(configuration: Configuration) -> some View {
configuration.label
.onChange(of: configuration.isPressed, { oldValue, newValue in
print("Is pressed: \(oldValue) -> \(newValue)")
})
}
}
struct ContentView: View {
var body: some View {
VStack {
Text("Buttons inside scroll view respond to taps as expected, however isPessed value of the configuration do not change unless the user press and hold it. Try to press the promiment button quickly or use the debug button and observe the console log.")
ScrollView {
VStack {
Button("Button Inside ScrollView") {
print("Button tapped")
}
.buttonStyle(.borderedProminent)
Button("Button Inside ScrollView (printing isPressed)") {
print("Button tapped")
}
.buttonStyle(DebuggingButtonStyle())
}
}
.border(FillShapeStyle(), width: 2)
Spacer()
Text("For reference, here is a button outside of a ScrollView. Tap the promiment button to observe how the button is expected to animate in respnse to a press.")
VStack {
Button("Button Outside ScrollView") {
print("Button tapped")
}
.buttonStyle(.borderedProminent)
Button("Button Outside ScrollView (printing isPressed)") {
print("Button tapped")
}
.buttonStyle(DebuggingButtonStyle())
}
}
.padding()
}
}
The default behaviour is that selecting an item will dismiss the menu. I see that some Apple's apps have items which will do some action but keep the menu open.
For example in Notes, there is Indent item which will indent the text but keep the menu open.
Is it possible to achieve this with the public API?
I downloaded Xcode 12.5 Beta and now an existing project does not compile with errors telling I can't use Class as a key in NSDictionary.
Cannot initialize a parameter of type 'id<NSCopying> _Nonnull const __unsafe_unretained' with an rvalue of type 'Class'
I have assumes so far that while Class does not conform to NSCopying, it is safe to use as a dictionary key because it implements copy and copyWithZone:.
Did anything change with that regard in the compiler/runtime shipped with Xcode 12.5? Is it safe (and endorsed practice) to cast to id<NSCopying> to silence these errors?