Modify text in SwiftUI - ios

If I changed the content of Text in SwiftUI, the text got stretch/truncated.
For example, let's say we changed the Text from "World" to "SwiftUI", we got the result as shown. How do we prevent this to happened?

Your code is working fine, it's probably a bug when you're previewing the app. If you actually run the app on a simulator you will see the text updating correctly. Hopefully it will be fixed in the next Xcode 11 beta releases.
Update: This issue was fixed with Xcode 11 beta 2.

Related

Xcode 8 - changes in constraints is not taking effect in preview

I've just upgraded to xcode 8 swift 3 and the whole layout of my project is a mess. I'm trying to change constraints but is not taking effect in preview like last version. I've follewed the same procedure I've used to Xcode 7.3. Are there something new that I don't know ?
After some more searching I found that this a bug. This workaround solved https://stackoverflow.com/a/39653512/2238515 my issue. On the other hand is waiting for an update from Apple
You might have to update frame. If when you modify in preview you see a yellow arrow next to the view then "Update Frame"

UITextView with text less than 10 characters hangs iOS 9

Starting from iOS 9 (I used Xcode 7.0 beta 6 (7A192o)), an Objective-C app with UITextView will hang if the text view's text is less than 10 characters. CPU usage goes up to 99-100% and the whole system hangs.
How to reproduce:
Create a brand new single view app from template (or anything else).
In storyboard, add a UITextView with default settings anywhere in the main view.
Set the text to a string that is less than 10 characters long.
Launch the app in simulator (any device, as long as it's iOS 9).
Upon launch, before displaying the single view, the system will hang and CPU usage will go to maximum forever.
Set the text to any other text that's more than 10 characters and the app runs correctly.a
Looks like constraints or any other settings do not affect this behaviour.
The immediate solution would be to simply not have less than 10 characters, but, well, that's lame.
You can check out this github repository that also demonstrates the problem.
I also submitted a bug report to Apple (bug no. 22736256, although you probably can't see it there yet).
Weirdest. Bug. Ever.
Is anyone also encountering this one??
Took me half a day to narrow the error down to a UITextView. This has got to be the stupidest bug ever.
You don't need to ensure that the UITextView holds at least 10 characters. Just adding a default of at least 10 characters to the UITextView in Interface Builder will fix the problem. Then, you can empty the UITextView using code.
By the way, this is an Xcode 7 bug, not an iOS9 bug. New builds built using Xcode 7 will create the same problem in iOS7 and iOS8.
According to the release notes of Xcode 7.1.1 this should be fixed now:
Storyboards and nibs containing UITextView elements with between 1 and 11 characters no longer hang when loaded on iOS. (23264732)
Refer the blow. It is a bug in Xcode 7 and still has not been fixed.
http://xcode7criticalbug.blogspot.in/2015/10/uitextview-bug-in-xcode-ios-app-getting.html
It can overcome by programatically setting the text property for UITextView.
i have found the solution first check the memory leak and please add the this line of code in particular class.
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:YES];
}
This is helpful for me my problem is resolved.

Attribute Unavailable: First baseline layout attribute on iOS versions prior to 8.0

I'm getting the following warning in XCode 6.1.
Attribute Unavailable: First baseline layout attribute on iOS versions
prior to 8.0
I think, this is also causing my iOS 7.x builds to crash.
Found the issue. This new constraint was added to iOS 8.0 and isn't supported with previous versions.
To get rid of this warning and allow iOS 7 builds to work you need to:
1. Click on the warning in the side bar (this should highlight the offending constraint)
2. Change that constraint to something other than "First Baseline". "Center Y" worked well for me. You'll have to play with the options and can see the changes live to see which alternative works for you.
iOS 7 now builds again and warning is gone.
We just ran into this exact same problem, but in our case, it didn't crash Xcode; it just drew the the view wildly out of place when run on an iOS 7 simulator. We fixed it by changing the constraint's item to plain ol' baseline.

Why my UI views have an iOS 6 look when in Xcode but not when building the app

I have a project that I created using Xcode 4 and the iOS 6 UI, when I opened the project with Xcode 5 for first the time I was asked if I wanted to convert the project and I said yes, It did its thing and everything worked fine, when I run the application it looks and feels like iOS 7 (the app is super simple). The issue or what I want to change is the way the UI views look in Xcode (UIBuilder), for instance if I add a new button to my view controller it shows the button with the border around it as in iOS 6, but again, when I run the app the border disappears, it looks like iOS 7 without the border which is what I want but it bothers me to see the border when I'm in Xcode.
Any idea? Is this a normal behavior when moving from one iOS version to another?
Thanks

UIBarButtonSystemItemPageCurl in iOS 5 beta missing

In my latest release application, everything looks good on iOS4+, but not on iOS5 Beta.
The only thing that is wrong is that the UIBarButtonSystemItemPageCurl is not shown on iOS5 devices. It shows an empty UIBarButtonItem with style Plain.
It looks good in IB in XCode 4.1, will test on my work computer as well on the BETA XCode tomorrow.
Does anyone know why this happens, or is this a bug in iOS5 beta?
EDIT
The question: If someone else found this too, how can I fix it (the correct way!)?
I'm still getting this issue with iOS 5.0 (non-beta). It looks like someone created their own page curl button here:
http://blog.shuningbian.net/2011/01/ios-toolbar-pagecurl-icon.html
Alternatively you can try using this tool to extract the icon from UIKit on a version 4 device:
https://github.com/0xced/UIKit-Artwork-Extractor
UIBarButtonSystemItemPageCurl can only be used in toolbars, at the bottom of the screen. Else the button is simply not displayed, like in a navigation bar.

Resources