Modular sign in with Apple in iOS

Over the years, authentication has been a creep for most of the mobile apps. At first, it was required for users to signup to start using any app. Then Apple and UX developers wondered Why users are required to signup for a thing they have not seen or used.

Thus, you should let them taste the application. Then, if they like it enough and would like to access more features, they are required to sign up. This, in turn, leads to having many paths to get your user to the signup process and many entry points.

Want to read this…

I’m a self-taught engineer, so I’ve always wanted to build something that can help others to overcome the hurdles you face when you try to learn how to program.

Nowadays, we’ve so MANY resources, endless videos/articles trying to teach you how to write your first ‘hello world’, think of all those links on your saved links bucket, back in time, there were a few, I’m glad we’ve come so far.

So I’ve started a community, to share knowledge and help everyone who’s looking for help, over the past two years a lot has been done within this community. …

I’ve always been keen on writing clean code, but I’ve not got in touch much with programming design patterns, as most of the developers I’ve learned a few on the go and ignored the rest. I’ve to get the shit done motto is the ultimate design pattern, but at the end of the day, you’ve to do the right thing.

I was just talking to a friend of mine about logging errors that ain’t crashes, we log crashes automatically with Fabric and Crashlytics, but what about our own error?

from Giphy

So he just told me why I’m not using Crashlytics? A quick search and I found the docs:

Amazing stuff to report now right?

Best practices:

1 — Import lib everywhere:

Don’t forget to use a wrapper for the library, so you don’t have to import it in every class:

import Crashlyticsstruct CrashLogger {  static func log(_ error: Error) -> Void {      Crashlytics.sharedInstance().recordError(error,
withAdditionalUserInfo: [:])

now you can easily use it from any place in…

UITableView/UICollectionView cell interaction

Getting the index of the selected cell is an easy thing to do, but I’ve seen so many implementations that use very weird ways in order to get the selection especially if the cell has many buttons/Actions to get its index.

Let’s get back to the basics, how do you get the index of a selected cell?

By simply implementing the table/collection view delegate

func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {} Or: func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {}

Those are the basic way to get a selection from the user, but what If I have a single…

Convert now, cry later😂

So you clicked that devilish button and now you’re having endless weird bugs list in your project libraries! Here’s how to fix it: Don’t panic.

Let’s take a step back: You’re using Cocoapods, or Carthage to add your dependencies to your project, and now you upgraded your compiler to work on swift 4.2, but some of your libraries haven’t been updated yet, so what to do?

Simply the answer is to tell your compiler the specific version for every library you’re using, this allowed via using a key “Swift_version” in build settings for pods, this process can be done manually…

Collection views can be a struggle sometimes!

Back when I used to work on Iqraaly app, I had a weird issue that I had without a clear reason behind it, which is having collection view scrolling left to right even we’re in an Arabic RTL app, and everything is set to Arabic, semantics is correct and it’s all good! so what’s wrong?

Turned out there’s a bug with collection views? I’m not sure what to call it but the fix I used back then:

//in viewDidLoadYourCollectionView.transform = CGAffineTransform(scaleX: -1.0, y: 1.0)//in cellForItemAtIndexPathcell.transform = CGAffineTransform(scaleX: -1.0, y: 1.0)

But it was a workaround, later I…

Apple reply after every upload!

This bundle is invalid — The file extension must be .zip.

Yesterday was a rough day due the upper message, I kept uploading my app to the store like almost 10 times, that’s almost 1 GB * 9 of my internet quota, and the issue isn’t very clear what’s going on with it!

So I went to our usual friend stackoverflow, and It had a consistent message:

  • Clean your project
  • Remove old certificates, create new ones
  • Reinstall pods mmm update?

This all seems like a pretty normal steps to follow, so I kept doing them all day, by the end…

Payfort SDK with swift project integration

There’s a common problem we as (iOS developers) will always have to deal with, and it’s APIs, starting from UIKit api down to server apis, and for sure 3rd parties API, we’re spoiled by the swifty syntax and we want everything to be swift as possible, and that’s kinda not happening with Payfort SDK here, so I wrote this quick guide so you’d be able to implement it easily in your project.

Adding Payfort sdk to your project is a hassle that you’ll have to go through since they don’t support cocoa pods, nor Carthage. They’re one of the old…

Close to using completion handlers, but it’s totally different when used with multiple requests.

If you’ve been following my netwrok layer topic, this would fit perfectly with upgrading your app networking layer, Promises is a great way to handle completion part in a very advanced and clean way, I’ve started to use it recently and I think you should too, another dependency I think it will be essential in any coming project for me, so let’s see how to do it!

Promises libs are doing almost the same job according to my first impression so I took the one with the most stars and biggest community:

and I started working with it. Adapting it…

Abdoelrhman Mohamed

Mobile software engineer @BleacherReport, working with swift and iOS mainly, and community founder @SwiftCairo

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store