SwiftUI fullscreen horizontal swipe with dot indicator - swiftui

Many apps have an intro view that has fullscreen pages with a dot indicator at the bottom. Sometimes it is used to gather same basic information, sometimes to introduce the app features.
How can I realize that?
I tried the ScrollView with a horizontal setting. The issue is to set up the content to fit the screen and have the edges snap on scroll. Second issue is the have a dotted indicator that highlights the current page.

you need to wrap UIPageControl with UIViewControllerRepresentable.

Related

Declare bottom zone in a SwiftUI navigation sidebar below a list

In the below screenshots (taken from the Apple Developer app), we can see that the Account button sticks to the bottom of the sidebar.
When the window is tall enough (left), the list doesn’t scroll, Account button’s background color has no difference. When the window is not tall enough (right), causing the list to scroll, Account button changes its background color to reveal the relationship.
The list's scroll position can not be probed. How can I declare the Account button in SwiftUI?
That app is a UIKit catalyst app and the sidebar uses scrollViewDidScroll which uses the contentSize to set a bottomButtonState which is passed into a child UIHostingController (so the account button can be SwiftUI) which I would assume switches between a clear or solid background.
We cant get the scroll info in SwiftUI however a possible workaround would be to add dummy 1 pixel high cell to the bottom of the list and using its onAppear to set a binding that is used in a bottom view to enable/disable a background colour and should achieve the same effect.

.tabViewStyle with animated swiping of tabs

Is it possible somehow to use the .tabViewStyle(.page) for animating swiping between tabs but with a look as the default style?
Basically I want the animated tab swiping but not the tiny centered tab icons that comes as a side effect of using .page instead of the default TabView.
The page feature seems more for swiping similar objects, not different tabs, but the swipe animation looks great, which is what I'm after.
Thanks!
Marcus

Changing Order For First Responders in SwiftUI TextFields

I am working on a crossword app.
I have a SquareView that contains a Text and TextField, to show the number and letter for a particular square.
A 2D array of those SquareViews forms the grid of the puzzle.
I can navigate back and forth horizontally through the TextFields using the tab key, and all the highlighting works (current square yellow, adjacent answer squares blue, all others white or black).
My problem arises when I want to toggle navigation, to move vertically. I thought that the order in which TextFields were navigated depended on the order in which they were added, so I toggled between a VStack of HStacks (across clues, running horizontally) and HStack of VStacks (for down clues, running vertically). Nope. SwiftUI always moves from left-to-right, top-to-bottom. How can I change this? I learned from this forum about Introspect, so I can access each TextField's underlying UITextField and change ... it's color 😀, but that's not what I need. I need to be able to change order in which first responders are chosen.
Any assistance would be most welcome!

swipe handled by ember-gestures, but also scrolls

I've creates a "touch-list" component for EmberJS, based on ember-collection, with ember-gestures mixed in:
import RecognizerMixin from 'ember-gestures/mixins/recognizers';
export default Ember.Component.extend(RecognizerMixin, {
recognizers: 'tap press swipe',
...
swipeLeft(event) {
...
event.preventDefault();
event.stopPropagation();
},
...
My test app has two panels, one for the list and the other for item details. (Slighly out-of-date source code is on GitHub.) On a screen 640px or wider, the container for the panels is set to the viewport width, and all is well - horizontal swipes are recognized, and don't trigger scrolling.
On a screen 639px or narrower, I set the container to twice the viewport width, and each panel to the viewport width. Horizontal swipes on the list header or detail panel scroll, as expected.
The problem is horizontal swipes on list items on touchscreen devices. They are recognized as gestures, and handled by list items, but they also cause horizontal scrolling! As seen above, I call event.preventDefault(); and event.stopPropagation(); but that doesn't help.
How can I prevent swipes from causing horizontal scrolling?
My solution was to change the layout so horizontal scrolling never happens. Now, the horizontal movement of the panels is implemented using transform: translateX(-100%);
I have thusly advanced to a new level of confusion:
How do I set a class on a parent element when a route is the first one loaded?

C++ Win32 how to remove tab borders WC_TABCONTROL

Hi I am trying to convert an existing WC_TABCONTROL window with TCS_OWNERDRAWFIXED so that I have full control of its appearance.
But it seems all I can draw is the tab headers and even there I do not have much control on how the borders are drawn around tab page as well as tab headers.
Can someone point me to some material that explain how to custom draw, tab items and tab pages. I need to have control on how both the background and borders are drawn.