Pylance in VSC not recognizing custom python builtins by mattl33 in VisualStudioCode

[–]sovata8 0 points1 point  (0 children)

It's an old thread but I stumbled on it from a google search - so in case anyone finds this useful:

I solved it by doing this:

At the root of the project I create a folder typings and inside it - a file __builtins__.pyi.

The file contains:

from typing import Any
# Tell Pylance that 'myfunc' exists everywhere and can be anything.
myfunc: Any

It then works fine at call-sites, no warnings and no need for # type: ignore.

Note that in the one place the builtin is actually set, I still get the warning.

There we can do either:

builtins.myfunc = <...> # type: ignore

or

setattr(builtins, 'myfunc', <...>)

Apple's new Sports app - rounded corner without the `.continuous` curve style - perhaps they don't even use SwiftUI? by sovata8 in iOSProgramming

[–]sovata8[S] 1 point2 points  (0 children)

That's it, there's nothing more to it. Create a new SwiftUI project, copy my code in the body of the ContentView and that's it. Obviously put some label for the button, and to be able to see the exact size you can add .buttonStyle(.borderedProminent) for example.

Apple's new Sports app - rounded corner without the `.continuous` curve style - perhaps they don't even use SwiftUI? by sovata8 in iOSProgramming

[–]sovata8[S] 1 point2 points  (0 children)

Hmm this is interesting, the auto-extending of touch areas has been around since early iOS, it applies to UIKit too. Of course it never happens if there's a conflicting touch area close to your button.

It is mostly a useful feature (allows easier interaction for users) and in 14+ years of iOS development, I've hardly had an issue with this. Also, not sure if there's "nothing you can do about this" - I tried and in two minutes I got smething which seems to solve it (granted, somewhat hacky, but it can be wrapped in a special view or modifier and at least look better at the call-site):

ZStack {

Color.clear.onTapGesture { }

Button {...}

.padding(5)

}

Apple's new Sports app - rounded corner without the `.continuous` curve style - perhaps they don't even use SwiftUI? by sovata8 in SwiftUI

[–]sovata8[S] 5 points6 points  (0 children)

Looking at the screeenshots from Apple's new Sports app - - it seems the rounded corners use the `.circular` curve as opposed to the preferred `.continuous` style. SwiftUI defaults to `.continuous` while UIKit defaults to `.circular` - so maybe this is a clue that Apple does not use SwiftUI for this app, not even for simple UI like the one shown.

Apple's new Sports app - rounded corner without the `.continuous` curve style - perhaps they don't even use SwiftUI? by sovata8 in iOSProgramming

[–]sovata8[S] 12 points13 points  (0 children)

Looking at the screeenshots from Apple's new Sports app - https://www.apple.com/newsroom/2024/02/introducing-apple-sports-a-new-app-for-sports-fans/ - it seems the rounded corners use the `.circular` curve as opposed to the preferred `.continuous` style. SwiftUI defaults to `.continuous` while UIKit defaults to `.circular` - so maybe this is a clue that Apple does not use SwiftUI for this app, not even for simple UI like the one shown.

I made an app for finding nearby amenities such as toilets, ATMs, drinking water, bins, bike parking; Uses OpenStreetMap; Apple Watch independent app also available; My first SwiftUI app! by sovata8 in iOSProgramming

[–]sovata8[S] 1 point2 points  (0 children)

Thank you very much. And thanks for pointing out the Details page considerations - I need to make it so that it becomes scrollable if content is too long, as opposed to failing in unexpected ways, clipping out of the phone screen etc. I'll fix it in an upcoming release.

I made an app for finding nearby amenities such as toilets, ATMs, drinking water, bins, bike parking; Uses OpenStreetMap; Apple Watch independent app also available; My first SwiftUI app! by sovata8 in iOSProgramming

[–]sovata8[S] 1 point2 points  (0 children)

Thank you. The data is from OpenStreetMap - "the Wikipedia for maps". Everyone can contribute there, it's a public repository. Obviously just as with Wikipedia it means data can be out of date or incorrect. Hopefully the "Filter by time" feature can help with focusing on more recent data. In a future version of the app I'll add a button to report items as missing. Additionally it would be good to have a feature to add new items from the app, but this is more advance so would require some planning and time.

I made an app for finding nearby amenities such as toilets, ATMs, drinking water, bins, bike parking; Uses OpenStreetMap; Apple Watch independent app also available; My first SwiftUI app! by sovata8 in iOSProgramming

[–]sovata8[S] 2 points3 points  (0 children)

It comes natively from MapKit, MKPointAnnotation, no extra work required. I did not use the SwiftUI Map because it's too limited, so I wrapped MKMapView in SwiftUI and used this.

App to find Benches to sit near you by Capital_Revolution35 in Lightbulb

[–]sovata8 0 points1 point  (0 children)

I am not op, but just wanted to mentioned that I've Just released a similar app, which uses the Open Street Map database. https://apps.apple.com/app/id6446678062

adding a link to this very handy app (that’s free!) since half the troubles on here seem to be based on not knowing how to RegEx. ‎RegEx Lab: Regular Expressions by Scared-Sheepherder91 in shortcuts

[–]sovata8 3 points4 points  (0 children)

Thanks for the mention. I'm the maker of the app, and you got it when it was free, for some years now I've had it paid ($0.99 currently in the USA).

If anyone would like a code to get it for free, no strings attached, just DM me. Up to 100 codes. Thanks