Tinder-clone-ios-public - Tinder clone application written using SwiftUI, Firebase, Swift Package Manager and iOS 15 features

Overview

tinder-clone-ios-public

Tinder clone application written using SwiftUI, Firebase, CoreData, Swift Package Manager and iOS 15 technologies with an MVVM architectural pattern. The app contains localizations for both English and Spanish languages. Below a more detailed description of the app features.

##Login screen Only Google Sign in is allowed. Once the user has logged in, the app will perform a check to decide if the user has already created a profile, if that's the case, he will be redirected to the Home screen, otherwise the Create Profile screen will be shown for the user to complete his profile information before proceding to use the application.

Create Profile screen

In this screen the user will be required to complete the following actions:

  • Add at least two profile pictures. This can be obtained through either the phone's photo library or the device camera. The necessary permissions are requested accordingly.
  • The user bio is optional, it can contain up to 500 characters. The remaining characters will be shown to the user as he types in the text editor.
  • The user name
  • The user's birthday. This will be used to calculate his age accordingly.
  • The user's gender (to simplify profile fetching and the matching algorithm only two options are available although more options could be added).
  • The user interests: his own gender, the opposite, or both.

Home screen

Here the user will be able to browse trough profiles and either swipe left or right on them in a Tinder-like fashion. Both swipe and button click to perform these actions are supported. If a user likes a user that has liked them before, a match showing said user will appear. Once a profile has been liked or disliked it will not be shown again to that user. From here the user can access to:

  • The Edit Profile screen
  • The Messages Screen

Edit Profile screen

This is the part that features the most complex backend handling. The user profile images are saved locally with the Firebase server timestamp. Before any download attempt, the local image timestamps will be checked and if they do not match, they will be downloaded. This prevents excessive download every time the user access this screen but nothing has changed since the last time. The appearance is similar to that of the Create Profile Screen but the following properties can not be modified:

  • Name
  • Birthday

Message screen

Here the user will be able to see his matches and access the corresponding Chat screen to send them messages.

Chat Screen

Here the user will be able to send messages to his matches and they will be updated in real time using Firebase snaphot listeners.

You might also like...
iOS Interactive Side Menu written in Swift.
iOS Interactive Side Menu written in Swift.

Interactive Side Menu A customizable, interactive, auto expanding and collapsing side menu for iOS written in Swift. Here are some of the ways Interac

ExpandingMenu is menu button for iOS written in Swift.
ExpandingMenu is menu button for iOS written in Swift.

ExpandingMenu ExpandingMenu is written in Swift. Requirements iOS 8.0+ Xcode 10.0+ Swift 3.x+ Installation CocoaPods You can install CocoaPods with th

A side menu controller written in Swift for iOS
A side menu controller written in Swift for iOS

Description SideMenuController is a custom container view controller written in Swift which will display the main content within a center panel and th

Beautiful iOS side menu library with parallax effect. Written in Swift
Beautiful iOS side menu library with parallax effect. Written in Swift

AKSideMenu AKSideMenu is a double side menu library with parallax effect. Example Project See the contained examples to get a sample of how AKSideMenu

An elegant dropdown for iOS written in Swift.
An elegant dropdown for iOS written in Swift.

UIDropDown An elegant dropdown for iOS written in Swift. Overview UIDropDown allows you to pick an option in a table just like dropdowns in web. It co

iOS Slide Menu Controller. It is written in pure swift.
iOS Slide Menu Controller. It is written in pure swift.

SlideMenuController Requirements iOS 9+ Installation SlideMenuController is available through CocoaPods. To install it, simply add the following line

A Slide Menu, written in Swift, inspired by Slide Menu Material Design
A Slide Menu, written in Swift, inspired by Slide Menu Material Design

Swift-Slide-Menu (Material Design Inspired) A Slide Menu, written in Swift 2, inspired by Navigation Drawer on Material Design (inspired by Google Mat

The elegant yet functional dropdown menu, written in Swift, appears underneath the navigation bar to display a list of defined items when a user clicks on the navigation title.
The elegant yet functional dropdown menu, written in Swift, appears underneath the navigation bar to display a list of defined items when a user clicks on the navigation title.

Introduction The elegant yet functional dropdown menu, written in Swift, appears underneath the navigation bar to display a list of defined items when

Animated top menu for UITableView / UICollectionView / UIScrollView written in Swift
Animated top menu for UITableView / UICollectionView / UIScrollView written in Swift

Persei Animated top menu for UITableView / UICollectionView / UIScrollView written in Swift! Made in Yalantis. Check this project on Dribbble Check th

Comments
  • Instructions for project

    Instructions for project

    I am wondering if you can provide step by step instructions for this project or if you followed a tutorial, can you provide the link? I cannot seem to get this project working right once i get to the setting up profile.

    opened by devhopes-ca 3
  • Please help: Value of type 'Date' has no member 'years'

    Please help: Value of type 'Date' has no member 'years'

    I am using Xcode 14.1, iOS 16 and recreating your project.

    In your file, FirestoreUser.swift, there is an issue with the return of age:

    var age: Int{ return Date().years(from: birthDate) }

    I am getting this error :: Value of type 'Date' has no member 'years'

    Please advise.. Thank you,

    opened by devhopes-ca 1
  • Issues in final update

    Issues in final update

    After add Google plist for Firebase, the following errors are coming up all in one file: EditProfileViewModel.swift:

    1. Invalid redeclaration of 'ProfilePicture' on line 11
    2. 'ProfilePicture' is ambiguous for type lookup in this context on line 22
    3. Type of expression is ambiguous without more context on line 30
    4. 'ProfilePicture' is ambiguous for type lookup in this context on line 40
    5. 'ProfilePicture' is ambiguous for type lookup in this context on line 77
    6. Type of expression is ambiguous without more context on line 79
    7. Command SwiftCompile failed with a nonzero exit code

    Please assist

    Attached is the code:

    // // EditProfileViewModel.swift // tinder-clone // // Created by Alejandro Piguave on 27/10/22. //

    import Foundation import UIKit

    struct ProfilePicture: Hashable{ let filename: String? let picture: UIImage }

    class EditProfileViewModel: NSObject, ObservableObject {

    private let firestoreRepository: FirestoreRepository = FirestoreRepository.shared
    private let storageRepository: StorageRepository = StorageRepository.shared
    
    @Published var userProfile: FirestoreUser? = nil
    @Published var userPictures: [ProfilePicture] = []
    @Published var isProfileUpdated: Bool = false
    
    @Published private (set) var isLoading: Bool = true
    @Published private (set) var error: String = ""
    
    func fetchProfile() {
        self.isLoading = true
        Task{
            do{
                //Fetch profile information
                let user = try await firestoreRepository.getUserProfile()
                DispatchQueue.main.async {
                    self.userProfile = user
                }
    
                //Fetch pictures
                let pictures = try await storageRepository.getPicturesFromUser(fileNames: user.pictures)
                var profilePictures: [ProfilePicture] = []
                for i in user.pictures.indices {
                    profilePictures.append(ProfilePicture(filename: user.pictures[i], picture: pictures[i]))
                }
    
                let finalProfilePictures = profilePictures
                DispatchQueue.main.async {
                    self.userPictures = finalProfilePictures
                    self.isLoading = false
                }
            }catch{
                publishError(message: error.localizedDescription)
            }
        }
    }
    
    //Update only profile fields
    func updateProfile(modified profileFields: [String: Any]) {
        self.isLoading = true
        Task{
            do{
                try await firestoreRepository.updateUserProfile(modified: profileFields)
                
                self.isLoading = false
                self.isProfileUpdated = true
            }catch{
                publishError(message: error.localizedDescription)
            }
        }
    }
    
    /**
     Updates the profile pictures
    
     - Parameter oldPictures: Array of the file names of the pictures that are already uploaded, in their respective order.
     - Parameter newPictures: Array of either: the file name of a picture that is already uploaded or a new picture.
     */
    func updateProfile(newPictures: [ProfilePicture], modified profileFields: [String: Any]? = nil){
        self.isLoading = true
        Task{
            let oldPictures = userProfile!.pictures
            //Gets the name of the pictures that are not among the new pictures.
            let filesToDelete = oldPictures.filter({ fileName in
                !newPictures.contains(where: { newPicture in
                    if let newPictureFilename = newPicture.filename {
                        return fileName == newPictureFilename
                    } else {
                        return false
                        
                    }
                })
            })
            
            let picturesToUpload: [UIImage] = newPictures.compactMap({ pictureUpload in
                if pictureUpload.filename == nil{
                    return pictureUpload.picture
                } else {
                    return nil
                }
            })
            
            do{
                async let deletePictures: () = storageRepository.deleteUserPictures(fileNames: filesToDelete)
                async let uploadPictures = storageRepository.uploadUserPictures(picturesToUpload)
                
                let (_, newFileNames): ((), [String]) = try await (deletePictures, uploadPictures)
                
                var updatedFileNames: [String] = []
                var count: Int = 0
                
                newPictures.forEach({
                    if let oldFilename = $0.filename {
                        updatedFileNames.append(oldFilename)
                    } else {
                        updatedFileNames.append(newFileNames[count])
                        count += 1
                    }
                })
                
                //If more values need to be updated then create a copy, otherwise create an empty dictionary
                var allProfileFields: [String: Any] = profileFields ?? [:]
                allProfileFields["pictures"] = updatedFileNames
                
                try await firestoreRepository.updateUserProfile(modified: allProfileFields)
                self.isLoading = false
                self.isProfileUpdated = true
            }catch{
                publishError(message: error.localizedDescription)
            }
        }
    }
    
    
    private func publishError(message: String) {
        DispatchQueue.main.async {
            self.error = message
            self.isLoading = false
        }
    }
    

    }

    opened by devhopes-ca 4
Owner
Alejandro Piguave
Android developer learning about iOS and mobile cross-platform technologies (Flutter).
Alejandro Piguave
A simple customizable side menu written in SwiftUI.

NSideMenu Description A simple customizable side menu written in SwiftUI. Give a Star! ⭐ Feel free to request an issue on github if you find bugs or r

null 5 Oct 10, 2022
Push Hero - pure Swift native macOS application to test push notifications

Dropdowns ❤️ Support my app ❤️ Push Hero - pure Swift native macOS application to test push notifications Quick Access - Organise files in the Mac men

Khoa 307 Oct 17, 2022
UIKit drop down menu, simple yet flexible and written in Swift

DropDownMenuKit DropDownMenuKit is a custom UIKit control to show a menu attached to the navigation bar or toolbar. The menu appears with a sliding an

Quentin Mathé 258 Dec 27, 2022
Menu controller with expandable item groups, custom position and appearance animation written with Swift. Similar to ActionSheet style of UIAlertController.

Easy to implement controller with expanding menu items. Design is very similar to iOS native ActionSheet presentation style of a UIAlertController. As

Anatoliy Voropay 22 Dec 27, 2022
Panels is a framework to easily add sliding panels to your application

Panels is a framework to easily add sliding panels to your application. It takes care of the safe area in new devices and moving your panel when the k

Antonio Casero 1.5k Dec 14, 2022
a simple macOS menu bar application that shows you the lyrics of current playing spotify track.

lyricsify a simple macOS menu bar application that shows you the lyrics of current playing spotify track.

Krisna Pranav 4 Sep 16, 2021
Mac menu bar tool to view the architecture of the running application

Silicon Info About Silicon Info is a tiny menu bar application allows the user to quickly view the architecture of the currently running application.

William Castelli (Billy) 260 Dec 29, 2022
Weather Dock is a MacOS headless application that shows popover view under the menu bar with weather info.

Weather Dock Weather forecast in MacOS menu bar Weather Dock is a MacOS headless application that shows popover view under the menu bar with weather i

Alexander Stepanischev 8 Dec 15, 2022
iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift.

SlideMenuControllerSwift iOS Slide View based on iQON, Feedly, Google+, Ameba iPhone app. Installation CocoaPods pod 'SlideMenuControllerSwift' Carth

Yuji Hato 3.3k Dec 29, 2022
A simple side menu for iOS written in Swift.

ENSwiftSideMenu A lightweight flyover side menu component for iOS with the UIDynamic's bouncing animation, UIGestures and UIBlurEffect. Allows you to

Evgeny Nazarov 1.8k Dec 21, 2022