Hi,When dragging a view inside UIScrollView using UIDragInteraction/UIDropInteraction, the scroll view *automatically* scrolls as you drag your view near the edge of the screen. How can you prevent this behavior? I want to disable *only* the automatic scrolling, not the scrolling itself, so that the user can scroll with the second finger if he so chooses. I know I can disable scrolling using isScrollEnabled, but this will also disable the user-initiated scrolling. Thanks.
Post
Replies
Boosts
Views
Activity
Hi,
Is there any way to refresh EKEventStore in Watch app? On iOS, you can call EKEventStore.refreshSourcesIfNecessary() to update the event store, but unfortunately this method is not available on watchOS.
Is there any alternative way to refresh calendar events and reminders? I find that sometimes events and reminders don't sync well in Apple Watch.
Thank you and best regards,
Kaz
Hi,
I would like to know if there's a way to get the sort order of reminders as they appear in the Reminders app. As you know, you can re-order reminders in Reminders app, but it seems that there's no way to get this ordering information using EventKit API.
Thank you and best regards,
Kaz
There's a feature to hide sensitive data in complications on Apple Watch, but is this feature available for third-party complications in watchOS 7?
Thanks!
I'm running the latest macOS Big Sur beta 9, and I have an AppKit app and added a widget extension using Xcode 12.2 beta 2. I can run my widget using WidgetKit Simulator and it's working great.
However, when I click the date/time on the menu bar to show the Notification Center and click the "Edit Widgets" at the bottom, I don't have my app listed in the list of apps. I tried copying my app's executable and put it in the "Application" folder, but the app still does not show up.
So how can I add/test my widget in Notification Center?
Thank you.
Hi,
When I run the following code in application(_ :didFinishLaunchingWithOptions) in iOS 15, the bar color turns transparent (thus, showing the black background underneath), while the same code works fine in iOS 14.5:
UINavigationBar.appearance().isTranslucent = false
UINavigationBar.appearance().barTintColor = .red
Here's the screenshots of Simulators running iOS 14.5 and iOS 15:
I'm using Xcode 13 on macOS Big Sur 11.4.
Thanks!
Hi,
The Background Tasks framework introduced in iOS 13 is also available in Mac Catalyst 13.0 according to the documentation.
However, the same code that runs on iOS 13 using the BGAppRefreshTaskRequest class does not work in my Mac Catalyst app.
So I was wondering whether or not the Background Tasks framework is supposed to work in a Mac Catalyst app.
Thanks!
public var body: some View {
List {
...
}
.listStyle(isPhone ? .plain : .sidebar)
}
When I write code like above, I get a compile error: "Member 'sidebar' in 'PlainListStyle' produces result of type 'SidebarListStyle', but context expects 'PlainListStyle'"
It looks like the root cause is:
Protocol 'ListStyle' can only be used as a generic constraint because it has Self or associated type requirements
How can I solve this problem?
Thanks,
In SwiftUI, is it a good idea to create a view model (or observed object) in a View? For example, if I write a code like this:
struct AView: View {
...
public var body: some View {
...
ForEach(...) {
...
otherView
}
}
private var otherView: some View {
let model = OtherViewModel()
return OtherView().environmentObject(model)
}
}
I guess this will re-create OtherViewModel every time AView is refreshed, so maybe this is not a good approach after all?
I thought about creating it in the constructor of AView, but if otherView is created multiple times using ForEach like the example above, it's difficult to know ahead of time how many of these models I need to create.
Any suggestion is highly appreciated!
Thanks,
Hi,
I'm having a hard time trying to solve this impossibly small problem in SwiftUI. I have a list like this:
struct ContentView: View {
var body: some View {
List {
Button(action: {
print("hello")
}, label: {
Text("Hello")
})
}
}
}
And every time I tap on it, the row deselect without animation, but I want the same effect as UITableView.deselectRow(at:animated:). Why is this so hard or am I missing something?
I don't want to use NavigationLink because I only want to execute code upon tap, not navigating to other view, unless it's possible to only execute code using NavigationLink...
Thanks,
Hi,
I'm trying to create a ViewController that extends UIHostingController and host an AttachmentView there. Also, I would like to pass an environment object to the AttachmentView, but I get a compile error because the type of rootView does not match what I specify in UIHostingController.
How can I get this code to compile?
Thanks!
There are many new iOS15-specific modifiers that were added in SwiftUI. For example, we have a .focused() modifier, which can be used like this:
TextField("Username", text: $username)
.focused($focusedField, equals: .username)
However, this code fails to compile if the app supports iOS 14 and earlier. How can I make this code to compile? Ideally, I'd like to do something like this:
TextField("Username", text: $username)
#if os(iOS, 15.0, *)
.focused($focusedField, equals: .username)
#endif
But obviously this won't work because #if os() can only specify the target OS, not the version..
Thanks!
Hi,
When I create a lock-screen widget with .accessoryInline, short date is always displayed as you can see in the screenshot below:
The text "Thu 21" does not come from my widget. How can I eliminate this?
Thanks,
Kaz
Hi,
I have an AppKit-based Mac app which was originally released in 2017. Since then, I've been constantly adding new features and now, I'm trying to add WeatherKit and other new features in macOS Ventura.
The problem is that Xcode 14 beta 3 fails to show my app's icon on the Dock:
The app icon is shown properly in Xcode and also in Finder:
When I open the exact same Xcode project and run it in Xcode 13/Monterey, the app icon is shown properly in the Dock.
Any help is appreciated!
Best,
Kaz
Hi,
Anyone knows how to prevent the floating thumbnail to show up when taking a screenshot of Simulator when pressing ⌘S?
Thanks!
Kaz