<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Swift Proof of Work</title>
    <description>The latest articles on DEV Community by Swift Proof of Work (@swiftpow).</description>
    <link>https://dev.to/swiftpow</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F9864%2F0eb1e48f-7cae-46b6-91ec-774f63dfac03.jpeg</url>
      <title>DEV Community: Swift Proof of Work</title>
      <link>https://dev.to/swiftpow</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/swiftpow"/>
    <language>en</language>
    <item>
      <title>Content Mode | IOS Swift</title>
      <dc:creator>Luiz Gabriel</dc:creator>
      <pubDate>Sat, 06 Jan 2024 12:47:40 +0000</pubDate>
      <link>https://dev.to/swiftpow/content-mode-ios-swift-39n8</link>
      <guid>https://dev.to/swiftpow/content-mode-ios-swift-39n8</guid>
      <description>&lt;p&gt;In this article we will talk about the ways in which elements can be worked with within a view, the value of this property by default comes as .scaleToFill.&lt;/p&gt;

&lt;p&gt;We use this property when we want to implement resizable controls. For example, instead of having to redraw every time, we use content mode so that the element adapts as necessary.&lt;/p&gt;

&lt;h2&gt;
  
  
  .scaleToFill
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Fills the entire view, so it can lose proportion
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3wg380f9rkmyy7sraadw.png" alt="Image description" width="588" height="1072"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  .scaleAspectFit
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Adjusts the content to fit the view while maintaining the aspect ratio, any remaining area is transparent
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frlplq00ftyrovwsdfmj6.png" alt="Image description" width="588" height="1072"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  .scaleAspectFill
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;It fills the view while maintaining the proportion, but the element may go beyond the limits of the view.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzw54f6h7avtdjapfda46.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzw54f6h7avtdjapfda46.png" alt="Image description" width="588" height="1072"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  .center
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Centers the content and maintains the same proportions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz6v0vcqu7o1kybvs6eln.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz6v0vcqu7o1kybvs6eln.png" alt="Image description" width="588" height="1072"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  .top
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Aligns and centers the content at the top of the view&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp7xpoovbhd4hj12tm1y3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp7xpoovbhd4hj12tm1y3.png" alt="Image description" width="588" height="1072"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  .bottom
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Aligns and centers the content at the bottom of the view&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffzfctcd70qo9v0qj5gf1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffzfctcd70qo9v0qj5gf1.png" alt="Image description" width="588" height="1072"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  .left
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Aligns and centers the content on the left side of the view&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F40quoot2qzjc4027lhwa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F40quoot2qzjc4027lhwa.png" alt="Image description" width="588" height="1072"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  .right
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Aligns and centers the content on the right side of the view&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb0ys1iyf3nepmkbkxcmd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb0ys1iyf3nepmkbkxcmd.png" alt="Image description" width="588" height="1072"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  .topLeft
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Aligns content to the left at the top of the view&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj1hsq6nkh2iqxktwjndn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj1hsq6nkh2iqxktwjndn.png" alt="Image description" width="588" height="1072"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  .topRight
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Aligns content to the right at the top of the view&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhtavj6xbjfgpkt3xepzv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhtavj6xbjfgpkt3xepzv.png" alt="Image description" width="588" height="1072"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  .bottomLeft
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Aligns content to the left at the bottom of the view&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F71dt6wl8u5clm8m3tn7z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F71dt6wl8u5clm8m3tn7z.png" alt="Image description" width="588" height="1072"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  .bottomRight
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Aligns content to the right at the bottom of the view&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvpn0fgojrwj1tb0wet9s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvpn0fgojrwj1tb0wet9s.png" alt="Image description" width="588" height="1072"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  .redraw
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Indicates that the view needs to be redrawn every time the size is changed, we use this when the content of the view depends on the view&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjp28twuuvbe4tek5twdw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjp28twuuvbe4tek5twdw.png" alt="Image description" width="588" height="1072"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for read this article!&lt;/p&gt;

</description>
      <category>ios</category>
      <category>swift</category>
      <category>beginners</category>
      <category>braziliandevs</category>
    </item>
  </channel>
</rss>
