Disable Xcode 8 code completion for image name - ios

Is there any way to disable code completion hints for image name in Xcode 8?

According to the manual you can't select what the code completion shows and not, since the code completion shows all the assets that it has to the apps disposal in its surrounding context. If xcode thinks it should first provide you with images from the asset catalogue, it will unfortunately do so.
You can turn the code completion of in the text editing preferences or you can toggle the code completion on and off when typing with Control-Space bar and you can dismiss the code completion with the Escape key. If you turned the code completion off in the text editing preferences you can still turn them on with Control-Space bar.

I created a snippet with the completion shortcut "in" that replaces itself with "in" to stop it from suggesting images when I'm trying to write a Swift closure. If you have other annoying use cases perhaps further snippets might help.

I've found a temporary solution by installing this plugin.
https://github.com/keith/IgnoreXcodeImageCompletions

Related

Xcode code completion missing variables & methods?

I was following along with this tutorial, and was very confused when I tried to access:
UINavigationBar.appearance().barTintColor
The reason I was confused is because Xcode doesn't show "barTintColor" as part of it's code completion.
Instead, it offers me "tintColor" and "backgroundColor", both of which do not work like the tutorial. However, when I manually type in "barTintColor" it works correctly.
Why would "barTintColor" not show up as part of my code completion? And is there something I can do to avoid similar confusion in the future?
If I had to guess, you're experiencing behavior because barTintColor is a property of a UINavigationBar, and not a property on the UIApperance protocol. Code completion must be trying to get the possible methods on the internal _UIAppearance.Type (the type of appearance()) rather than the UINavigationBar class.

iOS 9 Segue Causes App To Freeze (no crash or error thrown)

I have been working on this app for months now and from as far back as I can remember I have never had an issue with segues. The code is unchanged in terms of calling performSegueWithIdentifier but since my recent update to Xcode 7 and iOS 9 I have not been able to tack this issue.
I have tried:
Deleting button and creating new button w/ segue link
Using a direct segue from button to view, without the use of performSegueWithIdentifier
Connecting button to new blank viewController
When I press the button, no initial load functions are called on the destination VC (Ex: ViewDidLoad, ViewWillAppear, etc). When I connect it to a blank view, the segue works fine with the same code in place.
Since the code never stops, or breaks, and just seems to "freeze" in place while still running on Xcode I can't seem to even narrow this down to whats causing the issue. I have a similar segue that is also called from another button on the same ViewController that has no issues whatsoever.
Any thoughts on the matter are greatly appreciated!
EDIT: I have narrowed the issue down to the UITextView's causing the problem. Once the Text Views were removed the page loads fine via segue. I wonder what changed between iOS 8 and iOS 9 in terms of UITextView as I will have to remove the text views and completely re add new text views.
So basically the segue was freezing because of the UITextView's I was using in the destinationViewController. The following fixed the issue:
Delete all UITextView's
Add new UITextView's
you must leave the default lorem imposed text and change this programmatically in the viewDidLoad()
This was the fix for me, and from the research I have done on the issue it seems this is a bug in iOS 9 and Xcode 7.
Cheers!
NOTE: Removing the text in the UITextView (or making it longer then ~12 characters) is sufficient to work around it, no need to delete and recreate them. This is fixed in Xcode 7.1.1 and later.
I ran into the same issue and the fixes in this post (Xcode 7 crash: [NSLocalizableString length] 30000) solved the issue for me.
The first is to enable a localisation other than the base for the storyboard (see https://stackoverflow.com/a/32688815/3718974)
The second is to turn off the base localisation (see https://stackoverflow.com/a/32719247/3718974)
I think I have the same problem: I have a UITabelView with cells created from a nib file, when a user tap a cell this method is called:
and when I have the following method prepareForSegue:: the application crashes:
if I delete the line 129 Everything is ok , the method prepareForSegue:: open the right view and the label contactName is shown with its default text.
If I modify the method as follows prepareForSegue:: get exactly what you expect, without having any type of error:
let me know if you also get the same result
Any one who is facing this issue, i solved it by turning off the "Optimize rendering for windows scale" option in Debug of simulator window. I already had tried all of the above answers but could not solve the issue.
In the method in the first viewController where you activate the segue, do you have beginIgnoringInteractionEvents anywhere? If so the screen you segue to will be frozen and will ignore interaction events like you describe. If this is the case you can fix this by adding an endIgnoringInteractionEvents method before your segue method:
UIApplication.sharedApplication().endIgnoringInteractionEvents()
self.performSegueWithIdentifier("editItemToMyGearSegue", sender: self)
I realize this is an old topic, but appears to be still relevant. I was facing the same problem in Xcode 9, iOS11. My UITextViews are embedded inside UITableViewCells. Same symptoms as described here. The tricks with default text and placeholders did nothing for me, but I solved it by turning off the scrolling indicators for the text view in the xib. They were on by default, I guess, though unused.
Edit: this is probably an important detail... the views that were hanging all had an image NSTextAttachment in the attributed string of the text view. I think the image was wider than the available table cell content. With scrolling turned off, they appear to downscale.

Swift performSegueWithIdentifier delay

I have the following situation: I do a check when user touches screen, to check if it matches some bounds if menuButton.frame.contains(coordinates) {
Then, I try to push a segue like this performSegueWithIdentifier(menuButton.whichButton(menuButton.tag), sender: self) My problem is that the first time the segue performs, it has a huge delay (about 3-4 sec). Afterwards, everything runs as it should. I did check for main thread and I am in the main thread. Can you please help me?
I found the answer, as strange as it may appear, it was related with the fonts. I added some fonts, selected them in interface builder, but of course I didn't check the target membership. So the system was looking for them, I think, before reverting to default font, thus creating the lag. I hope it helps someone at some point.
Have you tried to run on a device or only in the simulator? Just to make sure...
You can try this too:
dispatch_async(dispatch_get_main_queue(),{
self.performSegueWithIdentifier(mysegueIdentifier, self)
})

Is there a way to see which line of code was just executed in Xcode?

I'm debugging an iOS app in Xcode, and I'm wondering is there any way to see which line of code I just ran? I'm trying to figure out where the code is that is responsible for making a menu slide open when I tap the menu key.
Thanks
Set a breakpoint (tap on a line number in Xcode) and manually run the code line by line using Xcode's Debug menu. In your case you can set a breakpoint on the method that is executed when a button is pushed. If you do not know which method is called when you push the button, you could look at where the button is declared, which should have a addTarget method, or see what it is hooked up to in the Storyboard.
If you have a few places where you think the code is executed, you can use NSLog() statements and see what is being printed to the console at what time.

iOS some problems during download multiple images and update UIProgressView

I have this 3 classes.
MyViewController.m (click to see code)
MySync.m (click to see code)
ImageDownload.m (click to see code)
When I download a image, I try to update the UIProgressView in my UIViewController, but the update are delayed, and I see a strange problem (see the blank space in attach image).
When all downloads are complete and execute the method "syncComplete" of "MyViewController", the method "dismissAlertView" is not triggered :S
I hope somebody can help me.
Thanks.
Assuming that syncComplete is the one calling dismissAlertView, make sure iI is calling to the UI thread (main thread). Something like this if you use GCD:
dispatch_async (dispatch_get_main_queue (),  ^{
// call the dismissAlertView method here
}); 

Resources