<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>SwiftUI on ZK Punk</title>
		<link>https://www.ZKPunk.dev/tags/swiftui/</link>
		<description>Recent content in SwiftUI on ZK Punk</description>
		<generator>Hugo</generator>
		<language>en</language>
		
		
		
		
			<lastBuildDate>Sun, 05 Feb 2023 12:03:15 +0530</lastBuildDate>
		
			<atom:link href="https://www.ZKPunk.dev/tags/swiftui/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Interval picker in SwiftUI</title>
				<link>https://www.ZKPunk.dev/tips/interval_picker_swiftui/</link>
				<pubDate>Sun, 05 Feb 2023 12:03:15 +0530</pubDate>
				<guid>https://www.ZKPunk.dev/tips/interval_picker_swiftui/</guid>
				<description>&lt;p&gt;Last run on Xcode 14.2, iOS 16.2, and Swift 5.7.2&lt;/p&gt;&#xA;&lt;h3 id=&#34;picker-view-for-time-durations&#34;&gt;&#xA;  Picker View for Time Durations&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#picker-view-for-time-durations&#34;&gt;&#xA;    &lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;Link to heading&#34;&gt;&lt;/i&gt;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;Link to heading&lt;/span&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;In my Timer app, I needed a Picker View for taking the timer interval from the user. Sadly, at this moment SwiftUI does not come with a built in View that I needed for my use case. However, SwiftUI does provide the building blocks to create such a view.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Change Back Button Icon in Navigation Bar</title>
				<link>https://www.ZKPunk.dev/tips/change_back_button_icon_navigation/</link>
				<pubDate>Tue, 31 Jan 2023 07:27:15 +0530</pubDate>
				<guid>https://www.ZKPunk.dev/tips/change_back_button_icon_navigation/</guid>
				<description>&lt;p&gt;Last Run on XCODE 14.2 / iOS 16.2 / Swift 5.7.2&lt;/p&gt;&#xA;&lt;h3 id=&#34;change-the-back-buttons-icon&#34;&gt;&#xA;  Change the Back Button&amp;rsquo;s Icon&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#change-the-back-buttons-icon&#34;&gt;&#xA;    &lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;Link to heading&#34;&gt;&lt;/i&gt;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;Link to heading&lt;/span&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;If you have used the default Settings App that comes with iOS, you are most likely to be familar with the back button with the &amp;ldquo;less than&amp;rdquo; symbol &amp;ldquo;&lt;em&gt;&amp;lt; Back&lt;/em&gt;&amp;rdquo; on the top left of your iOS devices screen (in the navigation bar). It&amp;rsquo;s something we have gotten very used to, thanks to it being implemented in not only the first party apps by Apple, but also the innumerous 3rd party apps that use the &lt;a href=&#34;https://developer.apple.com/documentation/swiftui/navigationstack&#34;&gt;NavigationStack&lt;/a&gt; and related API&amp;rsquo;s.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Dynamic Buttons to handle different app behvaior in SwiftUI</title>
				<link>https://www.ZKPunk.dev/tips/toggling-button-based-on-app-state/</link>
				<pubDate>Sat, 21 Jan 2023 12:42:15 +0530</pubDate>
				<guid>https://www.ZKPunk.dev/tips/toggling-button-based-on-app-state/</guid>
				<description>&lt;p&gt;Last Run on XCODE 14.2 / iOS 16.2 / Swift 5.7.2&lt;/p&gt;&#xA;&lt;h3 id=&#34;making-a-dynamic-button&#34;&gt;&#xA;  Making a Dynamic Button&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#making-a-dynamic-button&#34;&gt;&#xA;    &lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;Link to heading&#34;&gt;&lt;/i&gt;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;Link to heading&lt;/span&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;If you have noticed, the play button on most media players changes to pause once the media starts playing and vice versa. This is a behavior, I also needed in one of my apps that I was building.&lt;/p&gt;&#xA;&lt;p&gt;It&amp;rsquo;s a functionality pretty staright forward to achieive in SwiftUI.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Making a Progress View Ring</title>
				<link>https://www.ZKPunk.dev/tips/making-a-progress-view-ring/</link>
				<pubDate>Tue, 17 Jan 2023 13:48:35 +0530</pubDate>
				<guid>https://www.ZKPunk.dev/tips/making-a-progress-view-ring/</guid>
				<description>&lt;p&gt;Last Run on XCODE 14.2 / iOS 16.2 / Swift 5.7.2&lt;/p&gt;&#xA;&lt;h3 id=&#34;progress-view-ring&#34;&gt;&#xA;  Progress View Ring&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#progress-view-ring&#34;&gt;&#xA;    &lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;Link to heading&#34;&gt;&lt;/i&gt;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;Link to heading&lt;/span&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;I was building a Timer app and needed a visual indicator to display the the amount of time left while the countdown was running. A circular progress bar similar to the fitness/activity rings of Apple Watch made the most sense. Sadly, Apple currently doesn&amp;rsquo;t provide a good API to use such a view in your own apps. However, building such a View in SwiftUI is pretty simple.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Injecting custom behavior during editmode on a TextField in SwiftUI</title>
				<link>https://www.ZKPunk.dev/tips/injecting-custom-behavior-during-editmode-on-textfield-in-swift-ui/</link>
				<pubDate>Fri, 17 Jul 2020 08:30:06 -0700</pubDate>
				<guid>https://www.ZKPunk.dev/tips/injecting-custom-behavior-during-editmode-on-textfield-in-swift-ui/</guid>
				<description>&lt;p&gt;Last Run on XCODE 11.6 / Swift 5.2&lt;/p&gt;&#xA;&lt;h3 id=&#34;definitions&#34;&gt;&#xA;  Definitions&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#definitions&#34;&gt;&#xA;    &lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;Link to heading&#34;&gt;&lt;/i&gt;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;Link to heading&lt;/span&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://developer.apple.com/documentation/swiftui/textfield&#34;&gt;&amp;lsquo;TextField&amp;rsquo;&lt;/a&gt; is a View provided in SwiftUI for handling user entered input into an app. As per the documentaion, Apple defines it as&lt;/p&gt;&#xA;&lt;p&gt;&amp;ldquo;TextField - A control that displays an editable text interface.&amp;rdquo;&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-swift&#34; data-lang=&#34;swift&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;TextFieldEditMode&lt;/span&gt;: View {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    @State &lt;span style=&#34;color:#66d9ef&#34;&gt;private&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; someData = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; body: some View {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        TextField(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Type something&amp;#34;&lt;/span&gt;, text: &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;$&lt;/span&gt;someData)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            .font(.largeTitle)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;initializers&#34;&gt;&#xA;  Initializers&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#initializers&#34;&gt;&#xA;    &lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;Link to heading&#34;&gt;&lt;/i&gt;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;Link to heading&lt;/span&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;The &lt;a href=&#34;https://developer.apple.com/documentation/swiftui/textfield&#34;&gt;&amp;lsquo;TextField&amp;rsquo;&lt;/a&gt; has four initializers, and the one we will be using in this post is the one listed below, that provides us with two additional parameters&#xA;&amp;ldquo;onEditingChanged&amp;rdquo; and &amp;ldquo;onCommit&amp;rdquo;.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Custom View Modifiers in SwiftUI</title>
				<link>https://www.ZKPunk.dev/tips/custom-view-modifiers-in-swift-ui/</link>
				<pubDate>Wed, 15 Jul 2020 21:32:39 -0700</pubDate>
				<guid>https://www.ZKPunk.dev/tips/custom-view-modifiers-in-swift-ui/</guid>
				<description>&lt;p&gt;Last Run on XCODE 11.6 / Swift 5.2&lt;/p&gt;&#xA;&lt;p&gt;In SwiftUI View(s) are the building blocks of the UI. All changes to the Views are done by calling special functions called modfiers that wrap up the original View with the needful changes and return a View back.&lt;/p&gt;&#xA;&lt;p&gt;In the example below, we apply a few modifiers to a Text view to create the impression&#xA;of a highlighted text.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-swift&#34; data-lang=&#34;swift&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Text(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;I ♥️ SwiftUI&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    .font(.largeTitle)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    .foregroundColor(.black)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    .background(Color.yellow)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;img src=&#34;https://www.ZKPunk.dev/img/swift_ui_modifier_1.png&#34; alt=&#34;SwiftUI Text modifiers&#34;&gt;&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
