Fresh Beginning
  • Home
  • Speaking
  • Reading
  • Github
  • Alma Mater
  • Contact

Swift

A collection of 62 posts

iOS, Objective-C, Swift, Programmatic layout, Xcode 10, Xcode 11

iOS - Creating Programmatic Layout without using Storyboard (Swift/Objective-C)

There are two ways of creating layout on iOS. First, using readymade storyboard provided by Xcode when you create a new project. And second, by manually creating a UIViewController subclass and assigning it

  • Jayesh Kawli
3 min read
iOS, Swift, Xcode 10.1, Xcode, Drag and Drop, DragDrop, Postmates, Interview Questions, Interview

Drag and Drop on iOS using Swift

Hello folks, it's been a while since I wrote my last article. Today we're going to learn how to implement drag and drop feature on iOS using Swift. To see in advance what

  • Jayesh Kawli
5 min read
UICollectionView, UICollectionViewCell, Tutorial, Swift, Advanced Swift

Tutorial - Creating Programmatic UICollectionView in Swift

Creating a UICollectionView could be stressful - As compared to dealing with UITableView. But things don't have to be this way for so long. Every time I have to add a CollectionView in

  • Jayesh Kawli
6 min read
Swift, iOS, Codable, Swift 4.0, Encodable, Decodable, Swift 4.1

Using Codable Protocol in Swift 4.1

Swift 4 Codable protocol to decode and encode json data and model objects. Explained with examples.

  • Jayesh Kawli
10 min read
UITableView, Swift, iOS

Add headers and footers to tableview sections

In the previous post, we saw how to add header and footer views to entire table view. In this post, we will see how to add header and footers to individual UITableView sectionsBefore

  • Jayesh Kawli
3 min read
Xcode, debugger, Debugging, symbolic breakpoints, Advanced debugging, Swift, Objective-C, lldb, Command Line, symbolic

Xcode symbolic breakpoints - Break at method call

Today I am going to write about the big advanced debugging feature of LLDB. I am calling it advanced because I myself didn't know about it for a long time. It allows you

  • Jayesh Kawli
4 min read
Async, Asynchronous, Swift, Gotchas, Networking

Understanding the async behavior

Handling async behavior is tricky. I was caught into same gotcha when I first started dealing with async code few years back. It's useful behavior in most of the programming applications, especially when

  • Jayesh Kawli
3 min read
yyyy, DateFormatter, iOS, Gotchas, Tricks, Swift, Foundation

Challenges of DateFormatters

Working with DateFormatters is tough - At least on iOS. Today I will show with an example how I shot myself in the foot while working with simple DateFormatters problem. Here's the problem

  • Jayesh Kawli
2 min read
Minesweeper, Game, Side Projects, Refactor, Advanced Swift, Swift, Objective-C

Rewriting a Minesweeper - Part 3

Welcome to part 3 of the Minesweeper game. Today we will see logic behind some of the core and bonus features in the game. Highlighting tilesTiles highlighting is triggered when user taps on

  • Jayesh Kawli
3 min read
Minesweeper, Game, Side Projects, Refactor, Advanced Swift, Swift, Objective-C

Rewriting a Minesweeper - Part 2

Happy new year to all. I guess as I am getting old, I am not feeling enthusiastic enough about new years. There is one thing I am excited about though. Writing a rewriting

  • Jayesh Kawli
6 min read
Minesweeper, Game, Side Projects, Refactor, Advanced Swift, Swift, Objective-C

Rewriting a Minesweeper - Part 1

I am going to being this series of post on how I found my 4 year old Minesweeper game project written in Objective-C and process to start converting it into Swift. My goals

  • Jayesh Kawli
2 min read
iOS, Swift, Xcode, Metadata, plist

How to get the iOS App Metadata in Swift

Working on a new app could be exciting. However, there are certain things or information which you might want to get as a part of the core feature. One of them is the

  • Jayesh Kawli
2 min read
Swift, Memory Leak, Memory, weakify, unowned, retain cycle, KrakenDev, StackOverflow, iOS, Xcode, App Development, iOS Developer

When to weakify

Today I am going to talk about one of the discussion prone topics on iOS platforms. Detecting memory leaks and when to apply weakify. The topic came up while I was recently performing

  • Jayesh Kawli
9 min read
NSObject, Equality, Equatable, Swift, Objective-C

Caveats while using Equatable with NSObject

Today I am going to talk about how to use Equatable with Swift and NSObject inherited objects. This is interesting because last week I came to know about the fact that Swift's inbuilt

  • Jayesh Kawli
3 min read
Swift, Objective-C, Gotchas, Mistake, Error, Switch-case, Month

Refactoring Gotcha

Today I am going to write about recent refactoring gotcha I ran into. Hopefully this won't be a long post as I usually do. So let's move directly to the coding example. I

  • Jayesh Kawli
3 min read
Monty-Hall problem, Monty hall, monty, hall, Probability, Simulation, Swift, Xcode

Implementing Monty-Hall problem

Today, I am going to write about the Monty-Hall problem simulation I ran programmatically. What is this Monty-Hall problem you may ask? According to Wikipedia, The Monty Hall problem is a brain teaser,

  • Jayesh Kawli
4 min read
Swift, Swift 4.1, Closure, Closures, Memory Leak, Memory, iOS, Apple

Swift - Fighting memory leaks in closures

Swift is a great language. In fact, it's among my top 3 favorite languages. It is quite strict in terms of discipline and best practices which pay off in the long-term to offer

  • Jayesh Kawli
10 min read
Xcode 9, Swift 3.0, Swift, Tricks, Tips, Tutorial, Xcode Preferences

Random Xcode Trick

Despite my regular rantings on Xcode and Apple software, I still love them. In past few years, I have used so many IDEs and trust me, Xcode is one of the best I

  • Jayesh Kawli
1 min read
Swift 4.0, Objective-C, Swift, Tips, Tricks, structs, classes, variables, Bridging header

Using Swift variables in Objective-C : Swift 4 Edition

Today I ran into weird problem which prompted me to write this blog post on Objective-C and Swift interconnectedness. Before Swift 4 came along, the sure way to access Swift variables in Objective-C

  • Jayesh Kawli
2 min read
Swift 3.0, Swift, map, flatMap, First class functions, Functional Programming, Functional, Functional Swift, for-loop

Functional magic with Swift

Last few days I have been experimenting with functional magic in Swift. Especially how map and flatMaps work. I was so amazed to know how hassle-free my life became after I understood and

  • Jayesh Kawli
3 min read
Swift, Xcode 9, Xcode, Closure, Closures, iOS, Example, Demo

Closure Trick in Swift

Today I learned a closure trick in Swift. Usually when expression is assigned to a variable on left, it is evaluated instantly. For example, let value = complexCalculation() func complexCalculation() -> String { return

  • Jayesh Kawli
1 min read
MVVM, iOS, Swift, Swift 3.0, Xcode, VIPER, Architectures, iOS Architectures

Comparing VIPER vs. MVVM

Recently I started playing with VIPER architecture. Although I was quite hesitant trying it out, it turns out it's not all that bad as I expected. It'e certainly better than traditional MVC iOS

  • Jayesh Kawli
1 min read
Touch, Authentication, iOS8, Swift, Swift 3.0, App, Touch ID, iOS 8, Credentials, Password, Demo, Example, Tips, Github

Touch ID Authentication in the app

Today I am going to write about implementing and using Touch ID authentication in an iOS app. Touch ID authentication API was introduced in iOS 8 release. It is a part of LocalAuthentication

  • Jayesh Kawli
4 min read
Swift, Objective-C, Interaction, Interoperability, Bridging header, generated header file, gap, Bridging, Mix and Match, MixMatch, Github, Example, Tips, Gotchas

Swift and Objective-C Interaction

In this post I am going to write how you can use Swift code in Objective-C and vice versa. I have run into this problem multiple times and every time I hit the

  • Jayesh Kawli
4 min read
Core Data, Swift, Database, Persistency, Migration

Core Data Migration - Part 1 (Adding new fields)

While working on tiny side project, I realized that Xcode has made significant change in how core data migration takes place. Earlier, like couple of years ago I recall how I ran into

  • Jayesh Kawli
3 min read
Fresh Beginning © 2021
Latest Posts Ghost