skip to Main Content

I am really stuck and I need your help.

I am working on my web and iOS application. I used also Django to save users to database.

Login function is already working on my web (HTML) but I really don ´t know how to create function to iOS app (Swift).

I enclose also screens of Api HTML and Swift Code. Now it’s working only with Facebook. User can sign in using Facebook and order something using iOS App.

I would really like to do the same but with Login Function (not using FB). I hope you can help me. I don’t know how to do it and I’ve read a lot of web.

I would be really glad to you if you can help me.

Please HELP !
Thank you so much.

Image 1 – HTML Urls

Image 2 – Apis

Image 3 – Forms

Image 4 – social_auth_piplines

Image 5 – Models

Image 6 – Swift Apis

2

Answers


  1. This is very broad. There is a lot of questions that need to be answered before I can provide a solid answer but I’ll give you an idea on what you have to do.


    API

    First of all you need an api that serializes the data from your database so it acts as a layer between your app and backend. If you are using Django then take a look at Django Rest Framework which will help you achieve that.


    Networking Framework

    After setting up your api you need a networking layer in Swift to help you communicate with your api. You can use Swift’s URLSession or you can download Alamofire to make things a bit simpler. What a networking layer basically does is fetch the json provided by your Django app and changes it to a Dictionary so you can use it.

    Login or Signup to reply.
  2. In your django Application, you are to specify restframework Authentication to Token. You can get more info about token with django rest auth.

    In your iOS.What you need to do is create an AuthServices model. Now in your AuthServices model, you create your login function.

    For your login function I assume you are very familiar with Alamofire so you make an API request which would take your parameters and your header which I assume contains a token should also be specified.

    Keep your server running and run the application locally if you wish and take username and password with text fields. This should help you go on with it.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search