All Questions
117
questions
1
vote
1
answer
112
views
How to make all fonts of my controls the same size?
I'm creating an App with SwiftUI. In a view I have a TextEditor, Pickers and Steppers. I want the fonts to be the same.
This works:
let defaultTextSize: CGFloat = 20
Text("test")
.font(....
0
votes
0
answers
220
views
Why are sizes and strides of SIMD3<Float> and SCNVector different?
So when I was working with buffers I was having something like UnsafeRawPointer (which consisted of SCNVector3) and I was casting it to UnsafeBufferPointer<SIMD3<Float>>. And then I saw ...
1
vote
1
answer
135
views
ForEach inside HStack causes size to be zero
I was playing with a SwiftUI animation that required the view size. In my case, it is some list implemented using HStack. Since it consists of many items, I used the ForEach struct.
It shocked me when ...
-2
votes
1
answer
40
views
Why can't I set custom UIButton to the size I want?
I set up a button but the button can't become the size I want, I don't understand why, please help me thanks
attach my code here
var confirmButton : UIButton = {
let confirmButton = UIButton(type: ...
1
vote
0
answers
779
views
Remove UILabel top and bottom free space
Hi all. I'm trying to find a way to remove the white space (circled in the screenshot) above and below the text in a UILabel. I googled a lot, but i can't figure out. Thanks for help!
As @Sweeper ...
3
votes
1
answer
766
views
How to get the size of the new swift AttributedString?
NSAttributedString has a size() method which the new AttributedString lacks. How do you get the size of the new AttributedString?
0
votes
5
answers
2k
views
SwiftUI Image with high height layout
I'm trying to get a basic thing, but I can't make it work!
I would like to have a VStack that contains a text an image and a second text.
Everything should be visible on the screen. So the Image ...
6
votes
2
answers
720
views
In Swift, how to get the true size of an `Any` variable?
I want to be able to get the size of the underlying data type of an Any variable in Swift. I expected this to be possible by running MemoryLayout.size(ofValue: anyObject), but that expression always ...
0
votes
2
answers
157
views
How to fix the size of UIBarButtonItem when its font weight changes
Below is a short piece of demo code distilled from my project. It consists of a UINavigationBar, UINavigationItem, and several UIBarButtonItems. Tapping on a barButtonItem highlights it and dims the ...
0
votes
1
answer
215
views
Swift: Size of UIImage when slicing enabled
When I slice the image in the assets folder in Xcode, the size property of the UIImage returns a wrong value. Does anyone know how to get the real image size when the slicing is enabled? Does not ...
0
votes
1
answer
579
views
A view extension that runs conditional code based on its GeometryReader results
I’ve created a View extension to read its offset (inspired by https://fivestars.blog/swiftui/swiftui-share-layout-information.html):
func readOffset(in coordinateSpace: String? = nil, onChange: @...
0
votes
0
answers
104
views
Not able to display images with imageView in swift
I have confirmed the images are targeted in the project and are able to show in bigger image view.
Could not load the "red_check" image referenced from a nib in the bundle with identifier &...
2
votes
1
answer
2k
views
change sf symbol weight/size in TabView
This a a sample TabBar code:
struct TabBar: View{
@State var current = 0
var body: some View{
TabView(selection: $current) {
View0()
.tag(0)
.tabItem {
...
0
votes
1
answer
55
views
CollectionView Cell Changing Size when screen reloads
I am creating a screen where the user can search for films and the results load in a collection View, everything loads perfectly but in the simulator when I clicked "command, shift, A" to ...
0
votes
1
answer
211
views
I need the height of the hidden in a scroll view Swift
Example image:
I need de height in color blue.