<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Abdullah Mohammad Daihan on Medium]]></title>
        <description><![CDATA[Stories by Abdullah Mohammad Daihan on Medium]]></description>
        <link>https://medium.com/@daihanios?source=rss-7838523b0ed0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*3IfuMtW0ROsugGT1Qw0qhQ.jpeg</url>
            <title>Stories by Abdullah Mohammad Daihan on Medium</title>
            <link>https://medium.com/@daihanios?source=rss-7838523b0ed0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 10:17:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@daihanios/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Understanding When Null Checks are Necessary in Objective-C]]></title>
            <link>https://daihanios.medium.com/understanding-when-null-checks-are-necessary-in-objective-c-42306a431194?source=rss-7838523b0ed0------2</link>
            <guid isPermaLink="false">https://medium.com/p/42306a431194</guid>
            <dc:creator><![CDATA[Abdullah Mohammad Daihan]]></dc:creator>
            <pubDate>Sun, 22 Sep 2024 09:01:32 GMT</pubDate>
            <atom:updated>2024-09-22T09:12:23.875Z</atom:updated>
            <content:encoded><![CDATA[<h3>In Objective-C, sending a message to nil usually doesn’t cause a runtime crash</h3><p>In Objective-C, sending a message to nil usually doesn’t cause a runtime crash, unlike in many other languages. This is one of the features of Objective-C that helps prevent common null pointer exceptions. if you send a message to nil, it’s a no-op — nothing happens, and it doesn’t crash. The expression simply evaluates to nil, 0, NO, or {0} depending on the return type of the method.</p><pre>// MessageComponent.h<br><br>@interface MessageComponent : NSObject<br>@property (nonatomic, strong) NSString *text;<br>- (NSUInteger)textLength;<br>@end<br><br>// MessageComponent.m<br><br>@implementation MessageComponent<br>- (NSUInteger)textLength {<br>    return [self.text length];<br>}<br>@end<br><br></pre><p>In this `MessageComponent` class, we have a `text` property and a method `textLength` that returns the length of the text.</p><p>Now, let&#39;s create a `nil` instance of `MessageComponent` and call the `textLength` method:</p><pre>MessageComponent *nilMessage = nil;<br>NSUInteger length = [nilMessage textLength];  // This is okay. `length` will be 0.<br></pre><p>Even though `nilMessage` is `nil`, we can safely send it the `textLength` message. The method call simply returns `0`, because the return type of the `textLength` method is `NSUInteger`.</p><p>Similarly, we can access the `text` property without causing a crash:</p><pre>NSString *text = [nilMessage text];  // This is okay. `text` will be `nil`.<br></pre><p>Again, instead of crashing, this code simply assigns nil to text.</p><p>In many other programming languages, trying to call a method or access a property on nil (or null) would result in a null pointer exception and cause a crash. But in Objective-C, it&#39;s a no-op that simply returns a zero or nil value, depending on the return type of the method or property. This is a distinctive feature of Objective-C that helps prevent common null pointer exceptions.</p><h3>When Should You Check for `nil`?</h3><p>Although Objective-C’s flexibility with `nil` can make coding easier, there are specific scenarios where checking for `nil` is crucial. Let’s dive into these situations.</p><h4>1. Before Using Objects in Critical Code Paths</h4><p>If your code relies on an object for performing critical operations, you should check for `nil`. For example, if you’re expecting an object from a network call or database, always check whether it’s `nil` before proceeding.</p><p>Example:</p><pre>NSDictionary *response = [self fetchNetworkData];<br>if (response == nil) {<br> // Handle error scenario<br> return;<br>}</pre><p>In the example above, if the response from the network is `nil`, continuing without checking it could lead to unexpected behavior or a crash.</p><h4>2. When Dealing with Callbacks or Delegates</h4><p>In Objective-C, you often use delegates or completion blocks for callbacks. Before invoking a method on a delegate or calling a completion block, check if they are `nil` to avoid attempting to call something that doesn’t exist.</p><p>Example (for delegate check):</p><pre>if ([self.delegate respondsToSelector:@selector(didFinishLoading:)]) {<br>   [self.delegate didFinishLoading:data];<br>}</pre><p>Example (for block check):</p><pre>if (completion) {<br>   completion(result);<br>}</pre><p>In these examples, checking for `nil` prevents your app from trying to execute a delegate method or block that doesn’t exist, thus preventing a crash.</p><h4>3. When Working with Collections</h4><p>Collections like arrays, dictionaries, and sets should always be checked for `nil` before accessing their elements. Attempting to access a collection with a `nil` key or object can lead to issues.</p><p>Example:</p><pre>NSArray *items = [self loadItems];<br>if (items != nil &amp;&amp; items.count &gt; 0) {<br> // Access the first item safely<br>  id firstItem = items[0];<br>}</pre><p>Additionally, when adding objects to collections, ensure that you are not inserting `nil` values, as this will crash the app.</p><p>Example:</p><pre>NSMutableArray *array = [NSMutableArray array];<br>NSString *name = nil;<br>if (name != nil) {<br> [array addObject:name];<br>}</pre><h4>4. When Working with Files or Resources</h4><p>When loading data from files, images, or other resources, check if the file or resource exists to avoid working with `nil` data.</p><p>Example:</p><pre>NSData *data = [NSData dataWithContentsOfFile:@&quot;path/to/file&quot;];<br>if (data == nil) {<br>   NSLog(@&quot;File not found or unreadable.&quot;);<br>} else {<br>  // Process data<br>}</pre><p>This ensures that your application doesn’t crash due to missing files or unreadable resources.</p><h4>5. Before Dereferencing Pointers</h4><p>Pointer dereferencing should always be done cautiously, as dereferencing a `nil` pointer will cause your app to crash.</p><p>Example:</p><pre>MyObject *object = [self retrieveObject];<br>if (object != nil) {<br>  // Safe to dereference and access properties or methods<br>  [object performOperation];<br>}</pre><p>By checking if the pointer is `nil`, you avoid potential crashes caused by attempting to access properties or methods on a `nil` object.</p><h4>6. When Using Third-Party Libraries</h4><p>Third-party libraries often return `nil` when something goes wrong. It’s important to check for `nil` whenever working with methods or classes from third-party SDKs or libraries, as you cannot assume these methods will always return a valid object.</p><p>Example:</p><pre>NSString *result = [thirdPartySDK fetchData];<br>if (result == nil) {<br>   NSLog(@&quot;Error fetching data.&quot;);<br>}</pre><h4>7. When Passing Objects to Other Methods</h4><p>Before passing an object to another method, it’s wise to check if it’s `nil`, especially if the receiving method depends on the object’s presence. This will help avoid passing `nil` unexpectedly.</p><p>Example:</p><pre>if (data != nil) {<br>  [self processData:data];<br>} else {<br>  NSLog(@&quot;No data to process.&quot;);<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42306a431194" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How ‘self’ Operates Within Closures]]></title>
            <link>https://daihanios.medium.com/understanding-how-self-operates-within-closures-during-asynchronous-operations-516ce0d47165?source=rss-7838523b0ed0------2</link>
            <guid isPermaLink="false">https://medium.com/p/516ce0d47165</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[retain-cycle]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[escaping-closure]]></category>
            <category><![CDATA[memory-leak]]></category>
            <dc:creator><![CDATA[Abdullah Mohammad Daihan]]></dc:creator>
            <pubDate>Sun, 22 Sep 2024 07:41:05 GMT</pubDate>
            <atom:updated>2024-09-22T10:15:51.089Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>In Swift, when you use self inside a closure, the closure “captures” self. This means that it holds a reference to the object</em></strong>. This is a common line we get from official documentation or ChatGPT , right ? But What does it actually mean ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sSFHWatmvy3yCpzIN29Mzw.png" /><figcaption>Line number 21 executes at 11:00:00 am and line 22 executes after ten seconds 11:00:10 am. Since inside closure there has <strong>self</strong> right ? <strong><em>So consider self as a separate variable declared inside closure and it basically captures the memory block of URLPreview object at 11:00:00 am</em></strong>. If URLPreview object at 11:00:00 am was 0x1234, then inside closure the value of self variable is 0x1234.</figcaption></figure><p>Let’s clearly understand the term <strong><em>capture</em></strong>: if we want to call configure method, how will we call it ? <strong><em>urlPreview.configure(urlString: “bbc.com”) </em></strong>right ?<strong><em> </em></strong>now let’s call DispatchQueue closure like single line . Look at bellow we passing execute closure in single line.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m3Fwgeh7mI6_8T1o2C5jPw.png" /><figcaption>So basically at 11:00:00 am we are passing the closure named <strong><em>execute</em></strong> and <strong><em>self variable</em></strong> captures the memory of urlPreview which was at 11:00:00 am. Then after ten seconds which is 11:00:10 am, system triggers the closure and the value of <strong><em>self is 0x1234 , </em></strong>it will work on that memory. Now if that memory is visible in ui , we will see the changes otherwise we won’t.</figcaption></figure><h3>Let’s understand it more deeply: Bellow code will work</h3><p>Bellow code will update the label after ten seconds and show it as <strong><em>“loaded and bbc.com”</em></strong> .</p><pre>class ViewController: UIViewController {<br><br>    @IBOutlet weak var stackView: UIStackView!<br>    <br>    override func viewDidLoad() {<br>        super.viewDidLoad()<br>        addUrlPreview(with: &quot;bbc.com&quot;)<br>    }<br>    <br>    func addUrlPreview(with urlString: String) {<br>        let urlPreview = URLPreview.fromNib()<br>        stackView.addArrangedSubview(urlPreview)<br>        urlPreview.configure(urlString: urlString)<br>    }   <br>}<br><br>class URLPreview: UIView {<br>    <br>    @IBOutlet weak var loader: UIActivityIndicatorView!<br>    @IBOutlet weak var label: UILabel!<br>    <br>    var urlString: String?<br>    <br>    func configure(urlString: String?) {<br>        self.urlString = urlString<br>        label.text = &quot;loading api data&quot;<br>        loader.startAnimating()<br>        DispatchQueue.main.asyncAfter(deadline: .now()+10.0) {<br>            self.loader.stopAnimating()<br>            self.label.text = &quot;loaded and \(self.urlString)&quot;<br>        }<br>    }<br>}</pre><h3>But bellow code will show continuous loading and won’t update the label. Why ?</h3><p>We will understand the self inside escaping closure deeply using this example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R00ZBTeME9MjpuhFV9laPA.png" /><figcaption>What above code is doing? Suppose at 11:00:00 am line 14 executes and allocated memory of <strong>0x1234 </strong>for urlPreview (bbc.com) and add it to stackView, so whenever line 35 executes, self inside closure captures <strong>0x1234</strong> <strong>. </strong><br>Now at 11:00:01 am line 15 executes so, <strong>0x1234 urlPreview </strong>removed from stackView. Now at 11:00:02 am line 16 executes and allocated memory of <strong>0x5678 </strong>for urlPreview (cnn.com) and add it to stackView. So whenever line 35 executes, self inside closure captures <strong>0x5678.</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CHZfH0f63m60aeRNEGXe-w.png" /><figcaption>As we know that escaping closures stored in heap. So after 10 seconds of 11:00:00 it is 11:00:10 am right ? So then GCD will trigger the bbc closure at 11:00:10 am and inside closure, value of self is 0x1234 <strong><em>. </em></strong><em>Memory</em><strong><em> </em></strong>0x1234 is not deallocated because self inside closure holds a strong reference to it. So despite the condition is true we won’t see any changes in ui because we have removed 0x1234 from stackView. When the closure execution is finished there has no strong reference of 0x1234, so the memory block will be deallocated by ARC.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W0lrHDMotiG7F0Nc7GeUGA.png" /><figcaption>Similarly after 10 seconds of 11:00:02 am, it is 11:00:12 am right ? So then GCD will trigger the cnn closure at 11:00:12 am and inside closure, value of self is 0x5678 <strong><em>. </em></strong>Hence stackView and closure holding a strong reference to that memory block, so 0x5678 is not deallocated. But 0x5678 memory’s urlString is cnn.com . So condition is false, so loader won’t stop and label won’t update. <strong><em>That’s why will we will see continuous loading and won’t update the label .</em></strong> When the closure execution is finished there has one strong reference of 0x5678 (stackView), so the memory block will not be deallocated by ARC..</figcaption></figure><h3>Repository link</h3><p>clone bellow repository and run. You will see some logs, which will help you understand.</p><p><a href="https://github.com/daihan054/Understanding-How-self-Operates-Within-Closures-During-Asynchronous-Operations">https://github.com/daihan054/Understanding-How-self-Operates-Within-Closures-During-Asynchronous-Operations</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=516ce0d47165" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Effortlessly Distribute Your iOS App with GitHub: A Step-by-Step Guide [OTA — over the air]]]></title>
            <link>https://daihanios.medium.com/effortlessly-distribute-your-ios-app-with-github-a-step-by-step-guide-35a4b09abc28?source=rss-7838523b0ed0------2</link>
            <guid isPermaLink="false">https://medium.com/p/35a4b09abc28</guid>
            <category><![CDATA[ipa]]></category>
            <category><![CDATA[plist]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[testflight]]></category>
            <category><![CDATA[app-store]]></category>
            <dc:creator><![CDATA[Abdullah Mohammad Daihan]]></dc:creator>
            <pubDate>Tue, 12 Dec 2023 03:44:38 GMT</pubDate>
            <atom:updated>2024-10-01T10:09:17.369Z</atom:updated>
            <content:encoded><![CDATA[<p>Are you an iOS developer looking for a reliable way to distribute your app outside the App Store for testing or enterprise purposes? With Dropbox’s recent changes causing hiccups, GitHub emerges as a savior with its straightforward and developer-friendly platform. Let’s dive into how you can leverage GitHub for hosting your IPA and PLIST files for easy app distribution.</p><blockquote>To enable downloading your IPA file using a PLIST file on GitHub, you’ll need to host both the IPA and PLIST files on GitHub and then create a custom URL scheme for installation. Here’s a step-by-step guide to set it up:</blockquote><h4>Hosting the IPA and PLIST Files on GitHub</h4><p><strong>1. Upload the IPA File to a GitHub Repository<br></strong> — Create a new GitHub repository or use an existing one.<br> — Upload your IPA file to the repository.<br> — Note: GitHub has a file size limit of 100 MB. If your IPA file exceeds this, you might need to use Git Large File Storage (LFS).</p><p><strong>2. Create a GitHub Release<br></strong> — Go to your repository.<br> — Click on “Releases” and then “Create a new release” or “Draft a new release.”<br> — Tag your release, add a title, and describe the release.<br> — Attach the IPA file to the release and publish it.</p><p><strong>3. Get the Direct Download Link for the IPA File<br></strong> — Once the release is published, find the IPA under “Assets.”<br> — Right-click on the IPA file link and copy the link address. This is your direct download link.</p><h4>Preparing and Hosting the PLIST File</h4><p><strong>4. Create or Update the PLIST File<br></strong> — Now in your mac create a plist file and paste bellow code.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;<br>&lt;plist version=&quot;1.0&quot;&gt;<br> &lt;dict&gt;<br>  &lt;key&gt;items&lt;/key&gt;<br>  &lt;array&gt;<br>   &lt;dict&gt;<br>    &lt;key&gt;assets&lt;/key&gt;<br>    &lt;array&gt;<br>     &lt;dict&gt;<br>      &lt;key&gt;kind&lt;/key&gt;<br>      &lt;string&gt;software-package&lt;/string&gt;<br>      &lt;key&gt;url&lt;/key&gt;<br>      &lt;string&gt;raw_link&lt;/string&gt;<br>     &lt;/dict&gt;<br>    &lt;/array&gt;<br>    &lt;key&gt;metadata&lt;/key&gt;<br>    &lt;dict&gt;<br>     &lt;key&gt;bundle-identifier&lt;/key&gt;<br>     &lt;string&gt;xcode_bundle_id&lt;/string&gt;<br>     &lt;key&gt;bundle-version&lt;/key&gt;<br>     &lt;string&gt;1.0.2&lt;/string&gt;<br>     &lt;key&gt;kind&lt;/key&gt;<br>     &lt;string&gt;software&lt;/string&gt;<br>     &lt;key&gt;title&lt;/key&gt;<br>     &lt;string&gt;AppName&lt;/string&gt;<br>    &lt;/dict&gt;<br>   &lt;/dict&gt;<br>  &lt;/array&gt;<br> &lt;/dict&gt;<br>&lt;/plist&gt;</pre><p>— Replace `raw_link` with the actual direct download link of the IPA file from GitHub.</p><p>-- Replace xcode_bundle_id with your app bundle id in build setting of xcode.</p><p><strong>5. Upload the PLIST File to GitHub<br></strong> — Upload the created PLIST file in step 4 to the same GitHub repository.<br> — After uploading, go to the file in the repository and click on “Raw” to view the raw file.<br> — Copy the URL of the raw PLIST file. This is the link you will use for installation.</p><h4>Creating the Installation URL</h4><p>— Use the following format to create the installation URL:<br> ```<br> itms-services://?action=download-manifest&amp;url=[RAW_PLIST_LINK]<br> ```<br> — Replace `[RAW_PLIST_LINK]` with the raw PLIST file URL you copied from GitHub.</p><h4>Usage</h4><p>- Share the installation URL with your users.<br>- When they open this URL on their iOS device, it should prompt them to install the app, just like it did with the Dropbox links.</p><h4>Considerations</h4><ul><li>Ensure that both the IPA and PLIST files are accessible publicly if the repository is public. If your repository is private then above approach wouldn&#39;t work.</li><li>Since it&#39;s adhoc distribution so ipa should be uploaded via adhoc certificate means (development certificate not distribution certificate). So the user will download your app must add their device uuid to devices section of developer.apple.com</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35a4b09abc28" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Messenger typing animation in objective-c]]></title>
            <link>https://daihanios.medium.com/messenger-typing-animation-in-objective-c-f845aa8abe09?source=rss-7838523b0ed0------2</link>
            <guid isPermaLink="false">https://medium.com/p/f845aa8abe09</guid>
            <category><![CDATA[cakeyframeanimation]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[calayer]]></category>
            <category><![CDATA[uikit]]></category>
            <category><![CDATA[core-animation]]></category>
            <dc:creator><![CDATA[Abdullah Mohammad Daihan]]></dc:creator>
            <pubDate>Wed, 22 Nov 2023 06:12:37 GMT</pubDate>
            <atom:updated>2023-11-22T06:19:29.890Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/294/1*ccRnHjWB_SZ2Bd1B2yjO9Q.gif" /></figure><p>You can use BallPulseSyncIndicatorView class to show typing animation as facebook messenger. You can use BallPulseSyncIndicatorView both from storyboard and code.</p><p>BallPulseSyncIndicatorView.h</p><pre>#import &lt;UIKit/UIKit.h&gt;<br>IB_DESIGNABLE<br><br>@interface BallPulseSyncIndicatorView : UIView<br>@property (nonatomic, strong) IBInspectable UIColor *dotColor;<br>@property (nonatomic, assign) IBInspectable CGFloat dotSize;<br>@property (nonatomic, assign) IBInspectable CGFloat speed;<br>@property (nonatomic, assign) IBInspectable CGFloat gapBetweenDots;<br>@property (nonatomic, assign) IBInspectable CGFloat waveRadius;<br>- (void)startAnimating;<br>- (void)stopAnimating;<br>- (instancetype)initWithFrame:(CGRect)frame<br>                     dotColor:(UIColor *)dotColor<br>                      dotSize:(CGFloat)dotSize<br>                        speed:(CGFloat)speed<br>               gapBetweenDots:(CGFloat)gapBetweenDots<br>                   waveRadius:(CGFloat)waveRadius;<br>@end</pre><p>BallPulseSyncIndicatorView.m</p><pre>#import &quot;BallPulseSyncIndicatorView.h&quot;<br><br>@interface BallPulseSyncIndicatorView ()<br>@property (nonatomic, strong) NSArray&lt;CALayer *&gt; *dotLayers;<br>@property (nonatomic, assign) BOOL isAnimating;<br>@end<br><br>@implementation BallPulseSyncIndicatorView<br><br>- (instancetype)initWithFrame:(CGRect)frame {<br>    self = [super initWithFrame:frame];<br>    if (self) {<br>        _dotColor = [UIColor grayColor];<br>        _dotSize = 10.0f;<br>        _speed = 0.6f;<br>        _gapBetweenDots = 3.0f;<br>        _waveRadius = 5.0f;<br>        [self setupDots];<br>    }<br>    return self;<br>}<br><br>- (instancetype)initWithFrame:(CGRect)frame<br>                     dotColor:(UIColor *)dotColor<br>                      dotSize:(CGFloat)dotSize<br>                        speed:(CGFloat)speed<br>               gapBetweenDots:(CGFloat)gapBetweenDots<br>                   waveRadius:(CGFloat)waveRadius {<br>    self = [super initWithFrame:frame];<br>    if (self) {<br>        _dotColor = dotColor;<br>        _dotSize = dotSize;<br>        _speed = speed;<br>        _gapBetweenDots = gapBetweenDots;<br>        _waveRadius = waveRadius;<br>        <br>        [self setupDots];<br>    }<br>    return self;<br>}<br><br>- (instancetype)initWithCoder:(NSCoder *)aDecoder {<br>    self = [super initWithCoder:aDecoder];<br>    if (self) {<br>        [self setupDots];<br>    }<br>    return self;<br>}<br><br>- (void)setupDots {<br>    NSMutableArray *dotLayers = [NSMutableArray arrayWithCapacity:3];<br>    CGFloat verticalCenter = self.bounds.size.height / 2.0;<br>    CGFloat horizontalCenter = self.bounds.size.width / 2.0;<br>    <br>    for (NSInteger i = 0; i &lt; 3; i++) {<br>        CALayer *dotLayer = [CALayer layer];<br>        dotLayer.backgroundColor = self.dotColor.CGColor;<br>        dotLayer.bounds = CGRectMake(0, 0, self.dotSize, self.dotSize);<br>        dotLayer.position = CGPointMake(horizontalCenter + (i - 1) * (self.dotSize + self.gapBetweenDots), verticalCenter);<br>        dotLayer.cornerRadius = self.dotSize / 2;<br>        [self.layer addSublayer:dotLayer];<br>        [dotLayers addObject:dotLayer];<br>    }<br>    self.dotLayers = [dotLayers copy];<br>}<br><br>- (CAKeyframeAnimation *)createKeyframeAnimationWithKeyPath:(NSString *)keyPath {<br>    CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:keyPath];<br>    animation.removedOnCompletion = NO;<br>    return animation;<br>}<br><br>- (void)startAnimating {<br>    if (self.isAnimating) {<br>        NSLog(@&quot;daihan26oct BallPulseSyncIndicatorView is already animating&quot;);<br>        return;<br>    }<br>    <br>    [self setupDots];<br>    <br>    self.isAnimating = YES;<br>    CGFloat duration = 1.0 / self.speed;<br>    NSArray *beginTimes = @[@0.07, @0.14, @0.21];<br>    CGFloat deltaY = self.waveRadius;<br>    CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];<br>    CAKeyframeAnimation *animation = [self createKeyframeAnimationWithKeyPath:@&quot;transform.translation.y&quot;];<br>    animation.duration = duration;<br>    animation.keyTimes = @[@0.0, @0.33, @0.66, @1.0];<br>    animation.values = @[@0.0, @(deltaY), @(-deltaY), @0.0];<br>    animation.timingFunctions = @[timingFunction, timingFunction, timingFunction];<br>    animation.repeatCount = HUGE_VALF;<br>    <br>    for (NSInteger i = 0; i &lt; self.dotLayers.count; i++) {<br>        CALayer *dotLayer = self.dotLayers[i];<br>        animation.beginTime = CACurrentMediaTime() + [beginTimes[i] floatValue];<br>        [dotLayer addAnimation:animation forKey:@&quot;BallPulseSync&quot;];<br>    }<br>    NSLog(@&quot;daihan26oct BallPulseSyncIndicatorView started animating&quot;);<br>}<br><br>- (void)stopAnimating {<br>    if (!self.isAnimating) {<br>        NSLog(@&quot;daihan26oct BallPulseSyncIndicatorView is not animating&quot;);<br>        return;<br>    }<br>    <br>    self.isAnimating = NO;<br>    for (CALayer *dotLayer in self.dotLayers) {<br>        [dotLayer removeAnimationForKey:@&quot;BallPulseSync&quot;];<br>    }<br>    NSLog(@&quot;daihan26oct BallPulseSyncIndicatorView stopped animating&quot;);<br>}<br>@end</pre><h3>How to use this class ?</h3><p>Key Features of BallPulseSyncIndicatorView</p><p>`BallPulseSyncIndicatorView` offers several customizable properties:</p><p>- `<strong>dotColor</strong>`: The color of the dots.<br>- `<strong>dotSize</strong>`: The size of each dot.<br>- `<strong>speed</strong>`: The speed of the pulsating animation.<br>- `<strong>gapBetweenDots</strong>`: The space between the dots.<br>- `<strong>waveRadius</strong>`: The radius of the wave effect in the animation.</p><p>And two primary methods:</p><p>- `<strong>startAnimating</strong>`: Initiates the pulsating animation.<br>- `<strong>stopAnimating</strong>`: Stops the animation.</p><h3>Implementing in Storyboard</h3><p>1. <strong>Drag and Drop</strong>: Start by dragging a `UIView` into your storyboard. Set its class to `BallPulseSyncIndicatorView` in the Identity inspector.</p><p>2. <strong>Customize in Attributes Inspector</strong>: Use the Attributes inspector to adjust properties such as `dotColor`, `dotSize`, `speed`, `gapBetweenDots`, and `waveRadius`.</p><p>3. <strong>Layout Constraints</strong>: Apply Auto Layout constraints to position the view as needed.</p><h3>Implementing in code explicitly</h3><p>If you prefer adding the view programmatically, here’s how you can do it:</p><p>1. <strong>Initialization</strong>:</p><pre>BallPulseSyncIndicatorView *indicatorView = [[BallPulseSyncIndicatorView alloc] initWithFrame:CGRectMake(100, 100, 60, 20)<br> dotColor:[UIColor blueColor]<br> dotSize:10.0<br> speed:0.5<br> gapBetweenDots:5.0<br> waveRadius:4.0];</pre><p>2. <strong>Adding to the View Hierarchy:</strong></p><pre>[self.view addSubview:indicatorView];</pre><p>3. <strong>Starting the Animation:</strong></p><pre>[indicatorView startAnimating];</pre><p>4. Stopping the Animation:</p><pre>// Use this when you need to stop the animation<br> // [indicatorView stopAnimating];</pre><p>`BallPulseSyncIndicatorView` is a versatile and easy-to-use tool for adding a dynamic visual element to your iOS applications. Whether through Storyboard or code, you can effectively utilize this class to create engaging animations that enhance your app’s interactivity and visual appeal.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f845aa8abe09" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[13 ChatGPT Prompts Every iOS Developer Needs to Know: Boost Your Productivity Today!]]></title>
            <link>https://daihanios.medium.com/13-chatgpt-prompts-every-ios-developer-needs-to-know-boost-your-productivity-today-127a380c2174?source=rss-7838523b0ed0------2</link>
            <guid isPermaLink="false">https://medium.com/p/127a380c2174</guid>
            <category><![CDATA[chatgpt4]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[prompt-engineering]]></category>
            <dc:creator><![CDATA[Abdullah Mohammad Daihan]]></dc:creator>
            <pubDate>Thu, 10 Aug 2023 16:25:34 GMT</pubDate>
            <atom:updated>2023-08-19T15:02:04.249Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uK4OoXJOqTmrQt3AH62UAw.png" /></figure><p>ChatGPT is a powerful language model, and the key to unlocking its full potential lies in asking questions in just the right way. Asking question with perfect pattern can give you optimal results. I asked ChatGPT that i will use you in my day to day iOS development journey, so i need to know how can i ask you questions so that you will give me optimal results. ChatGPT provide me 13 example prompts, you will get some idea after reading them. First i will provide the template, you can copy the template for later use.</p><p>Here is the template.</p><pre>Act as: Expert iOS developer<br>Project Context: &quot;programming&quot;, &quot;coding&quot;<br>Environment: <br><br>Problem Statement:<br><br>Code section one introduction: <br><br>Code section one:<br>.h part:<br><br>.m part:<br><br>Attempted Solutions:<br><br>Additional Information:</pre><p>Here are the 13 example prompt you will get some idea, how to ask questions to ChatGPT.</p><ol><li><strong>Custom Animation:</strong></li></ol><pre>Act as: Expert iOS developer<br><br>Project Context: Adding a custom fade-in animation to a UIView.<br><br>Environment: Xcode 13, Swift 5.4.<br><br>Problem Statement: How can I create a smooth fade-in animation for a UIView?<br><br>Relevant Code:<br><br>Attempted Solutions: Tried using UIView.animate, but the transition is not <br>smooth.</pre><p><strong>2.Memory Leak in Objective-C:</strong></p><pre>Act as: Expert iOS developer<br>Project Context: Detecting a memory leak in an Objective-C class.<br><br>Environment: Xcode 12, Objective-C.<br><br>Problem Statement: How can I find and fix a memory leak in this class?<br><br>Relevant Code:<br><br>Attempted Solutions: Used Instruments but still can&#39;t locate the leak.</pre><p><strong>3. Integrating CoreData</strong></p><pre>Act as: Expert iOS developer<br>Project Context: Integrating CoreData for local data storage.<br><br>Environment: Xcode 13, Swift 5.5.<br><br>Problem Statement: What&#39;s the best way to set up CoreData for an iOS app?<br><br>Attempted Solutions: Read Apple&#39;s documentation but need a simpler explanation.</pre><p><strong>4. Handling Push Notifications</strong></p><pre>Act as: Expert iOS developer<br>Project Context: Implementing push notifications.<br><br>Environment: Xcode 12, Swift 5.3.<br><br>Problem Statement: How to properly handle push notifications for different iOS <br>versions?<br><br>Attempted Solutions: Followed online tutorials but facing inconsistencies.</pre><p><strong>5. Custom CollectionView Layout</strong></p><pre>Act as: Expert iOS developer<br>Project Context: Creating a custom layout for a UICollectionView.<br><br>Environment: Xcode 13, Swift 5.4.<br><br>Problem Statement: How to create a horizontal scrolling collection view with <br>paging enabled?<br><br>Attempted Solutions: Tried subclassing UICollectionViewFlowLayout but having <br>alignment issues. </pre><p><strong>6. Auto Layout in Objective-C</strong></p><pre>Act as: Expert iOS developer<br>Project Context: Implementing Auto Layout programmatically in Objective-C.<br><br>Environment: Xcode 12, Objective-C.<br><br>Problem Statement: How can I properly set constraints using Auto Layout in <br>Objective-C?<br><br>Relevant Code:</pre><p><strong>7. Handling App Permissions</strong></p><pre>Act as: Expert iOS developer<br>Project Context: Requesting and handling app permissions like camera, <br>location, etc.<br><br>Environment: Xcode 13, Swift 5.5.<br><br>Problem Statement: How to elegantly handle and request multiple app <br>permissions?<br><br>Attempted Solutions: Used third-party libraries, but want a native <br>approach. </pre><p><strong>8. SwiftUI View Transition</strong></p><pre>Act as: Expert iOS developer<br>Project Context: Creating a transition between two SwiftUI views.<br><br>Environment: Xcode 13, SwiftUI.<br><br>Problem Statement: How to make a custom transition between two SwiftUI <br>views?<br><br>Attempted Solutions: Tried using NavigationLink, but the transition is not as <br>desired.</pre><p><strong>9. Multithreading with GCD</strong></p><pre>Act as: Expert iOS developer<br>Project Context: Managing multiple threads using Grand Central Dispatch.<br><br>Environment: Xcode 12, Swift 5.3.<br><br>Problem Statement: How to properly use GCD for background processing and UI <br>updates?<br><br>Attempted Solutions: Used DispatchQueue, but facing race conditions. </pre><p><strong>10. In-App Purchase Implementation</strong></p><pre>Act as: Expert iOS developer<br>Project Context: Integrating in-app purchases.<br><br>Environment: Xcode 13, Swift 5.4.<br><br>Problem Statement: What are the steps to implement in-app purchases securely?<br><br>Attempted Solutions: Followed Apple&#39;s guidelines but facing validation issues.<br> </pre><p><strong>11. Implementing Dark Mode</strong></p><pre>Act as: Expert iOS developer<br>Project Context: Implementing Dark Mode support in the app.<br><br>Environment: Xcode 13, Swift 5.5.<br><br>Problem Statement: How can I ensure that my app&#39;s user interface adapts <br>seamlessly to Dark Mode?<br><br>Attempted Solutions: Used system-defined colors, but some custom elements are <br>not adapting properly.<br></pre><p><strong>12. Building a WatchOS App</strong></p><pre>Act as: Expert iOS developer<br>Project Context: Developing a companion WatchOS app for an existing iOS app.<br><br>Environment: Xcode 12, Swift 5.3.<br><br>Problem Statement: What are the best practices for creating a WatchOS app that syncs with an iOS app?<br><br>Attempted Solutions: Tried using Watch Connectivity Framework, but facing sync issues.</pre><p><strong>13. Accessibility Features</strong></p><pre>Act as: Expert iOS developer<br>Project Context: Implementing accessibility features for visually impaired users.<br><br>Environment: Xcode 13, Swift 5.4.<br><br>Problem Statement: How can I make my app fully accessible to visually impaired users, including VoiceOver support?<br><br>Relevant Code:<br><br>Attempted Solutions: Implemented some UIAccessibility protocols, but need <br>guidance on full compliance.<br></pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=127a380c2174" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Importance of podfile.lock in iOS app development]]></title>
            <link>https://daihanios.medium.com/importance-of-podfile-lock-in-ios-app-development-6624a6ae99ec?source=rss-7838523b0ed0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6624a6ae99ec</guid>
            <category><![CDATA[podfile]]></category>
            <category><![CDATA[cocoapods]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <dc:creator><![CDATA[Abdullah Mohammad Daihan]]></dc:creator>
            <pubDate>Fri, 11 Nov 2022 08:49:30 GMT</pubDate>
            <atom:updated>2022-11-11T09:43:10.098Z</atom:updated>
            <content:encoded><![CDATA[<h3>Importance of podfile.lock</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KeEXXyFEm6861d8rHxYACg.png" /><figcaption>podfile.lock banner</figcaption></figure><p>Never ever put podfile.lock in gitignore and never delete it. Because what happens under the hood is when a project is created and project creator runs pod install it basically download the pods and put the version of pods in podfile.lock. The name itself is self explanatory . It basically locks the pod version.</p><p>Suppose after some days when someone new in the team joins, clone the project and run pod install then he will get the exact same version of the pods which mentioned in the podfile.lock file.</p><p>So what to do when we need a newer version of specific pod ? just run pod update &lt;podname&gt; , then it will check if newer version is available or not if available it will download that version and update the podfile.lock file. Now if you want to update all the version of pods in your project then just run pod update .</p><p>So in summary i can tell is:</p><ol><li>Never put podfile.lock in gitignore</li><li>Never delete podfile.lock</li><li>Never run pod update unless you want to update all of the pods. Because it will update all the pod versions in your project which will eventually update the podfile.lock as well.</li><li>Never put specific version of your pod in podfile like pod &#39;A&#39;, &#39;1.0.0’ . Because if a specific pod depends on another pod which may create conflict.</li><li>How to check if pods have updated versions ? Just run pod outdated it will give you a list of which pod has updated version available.</li></ol><p>You can learn in details from the following links:</p><p>i) <a href="https://guides.cocoapods.org/using/pod-install-vs-update.html">https://guides.cocoapods.org/using/pod-install-vs-update.html</a></p><p>ii) <a href="https://guides.cocoapods.org/using/using-cocoapods.html">https://guides.cocoapods.org/using/using-cocoapods.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6624a6ae99ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>