What does Auto Scaling do in Xcode 10 xcasset image properties - uiimage

Found new option on xcasset catalogue image property in Xcode 10 called "Auto Scaling".
What does this property do?
Is it in any way related to Resizing: "Preserve Vector Data" when using PDF vector assets?

It looks like this may only be used by WatchOS.
From https://developer.apple.com/documentation/watchkit/supporting_multiple_screen_sizes?language=objc
Alternatively, in watchOS 5 and later, you can provide scalable PDF assets. Add a PDF as a 2x image asset, then set its Auto Scaling attribute to Automatic. When you load the PDF, the system scales the image based on the current device’s screen size as listed in the table. This allows you to provide a single asset for all four screen sizes.
I'm not sure if this works on iOS as well. I was unable to find any mention of auto scaling outside of this WatchKit documentation.

Related

Xcode custom symbol image set asset

From Apples documentation I read:
An alternative to creating bitmap images is to use template images or symbol images instead. Template images specify the shape you want to draw, but not the associated color information. Symbol images are similar to template images but are vector based, so they scale to different sizes. Both types of images simplify the process for supporting Dark Mode. They also reduce the number of image assets you must ship with your app.
Do I understand this correct that I can not use a vector based symbol image set as a replacement for bitmap but scalable?
Update
My situation:
I've an Image Set in my iOS project. There I can add three bitmaps for the three scaling options iOS devices support. Those images must be of type *.png
Now I would like to replace those three bitmaps with a single vector graphic file *.svg. This seems not possible. If I want to use vector graphic images I've to add another asset type called "symbol image set" (Xcode -> Editor -> Add Assets -> New Symbol Image Set).
So far so good but now my question. Those "symbol image set" assets only the the shape but not the color information into account. That's why I would like the "old" way where the color information is taken into account but the file being a vector graphics file (*.svg).
You don't actually need a Symbol Set for what you are trying to achieve.
All you need is a vector image in pdf format, marking it as Single Scale
Then, you can mark the asset as template (meaning you can tint it with any color) or original if you want to retain its original colors.
Finally, note that although you supply vector images, Xcode by default will produce png versions for all scales behind the scenes. If you need to preserve the vector data (which can help in some cases where you need to upscale) you can enable Preserve Vector Data as well.

Swift 4 How to force Xcode to render vector images?

I am writing the app using latest Swift 4.1.2 and Xcode 9.4.1 for iOS 11.4. So I want to use vector images in my app in PDF format. I made the simple app which showing the problem, please, look:
This app only show only one image, but if you rotate the screen, rendering happens and picture becomes beautiful.
So the question is: how to force Xcode render vector images in Main.storyboard without touching the code? So app upload already rendered images?
Go to -> Images.xcassets and select the image. From the attributes inspector, make sure that preserve vector data is checked as following:
I hope it solves your problem.
Xcode 9 changes situation for vector data by allowing you to choose to treat the image as a vector at runtime. This means the image can smoothly scale to arbitrary sizes. The only change you need to make is to tick Preserve Vector Data for the PDF image in the asset catalog.

Image Asset versus Vector Asset

When it comes to adding an icon to my app, there're two main options:
IMAGE ASSET || IMAGE VECTOR
What are the differences between the Image Asset and Vector Asset? What makes them different?
According to Android User Guide :
Image Asset Studio helps you create various types of icons at different densities and shows you exactly where they'll be placed in your project. It includes tools for adjusting your icons and adding backdrops, all while displaying the result in a preview pane, so they appear exactly as you intended.
Vector Asset Studio adds a vector graphic to the project as an XML file that describes the image. Maintaining one XML file can be easier than updating multiple raster graphics at various resolutions.
When you create an image asset it will automatically create a vector graphic that describes that image as an xml file in the drawable..thus you can maintain that one xml file of your image rather than update it in multiple graphics and resolutions.
When you create a vector asset you simply create an xml file that describes an image/graphic in the drawables.

How to use vector images in Xcode 6.4

I've drawn up an image in Adobe Illustrator CS6. I export/save the image as a PDF. In Xcode, I create an image set and set the scale factor to Single Vector.
Yet when I use the image in my app, it still appears pixilated.
I've used vector images in older versions of Xcode (6.1 & 6.2) and it worked fine. Why is it not working in 6.4?
Try this article. It describes how to save vector image correctly and how to use it in Xcode.
IMPORTANT TO KNOW: Xcode slices your vector image to needed dimension. E.g. if you'll put 50x50 vector image it will create 50x50(x1), 100x100(x2), 150x150(x3) images. So you should to save original vector image for x1 dimension.
If you are testing on the simulator, try testing on an actual device. If you look at the images on all the other apps that are in the simulator, you will notice that they are all pixilated also.

Why don't images used in xibs show up in app wide searches

I am in the process of going through a large project and removing unused image assets. I had been using cmd+shift+f to perform a project wide search for given image names. I'd assumed this was working until I realized that if I set an imageview to display an image in interface builder that image reference was not showing up in my search.
Why doesn't the app wide search look for a value within an xib file?
Below is an image in a sample project which recreates the issue. I'm assigning img2 in the xib, but as you can see in the search results img2.png is not found.

Resources