Code Monkey home page Code Monkey logo

hipointernship's Introduction

Hipo Assigment Project

This project has been assigned for the HipoLabs company's internship program

Images and GIF's

  • Dark Mode

  • Light Mode

  • How Drop down framework works

3rd Party Libraries

SnapKit
DropDown

Installation

Install the 3rd party libraries to use this project

pod install

Architecture

  • MVC architecture was used in this project.

Code Sample

Sorting members Rule.

  • By using the extension function you wrote, find the most occurences of the character for each string in the array and sort in descending order.
extension String {
    func countNumberOfOccurrences(character: Character) -> Int {
        return self.filter { $0 == character }.count
    }
}
  • If two or more strings contain the same amount for the character, sort these according to their length.
  • If two or more strings contain the same amount for the character and have the same length, sort these in alphabetical order.
func sortMembers(char: Character){
        var hipoData = PersistenceManager.load()
        var members = hipoData[0].members

        members.sort(by: {
            let userFirst = $0.name.lowercased()
            let userSecond = $1.name.lowercased()

            if userFirst.countNumberOfOccurrences(character: char) > userSecond.countNumberOfOccurrences(character: char) { // find the most occurrences char
                return true
            } else if userFirst.countNumberOfOccurrences(character: char) == userSecond.countNumberOfOccurrences(character: char) &&
                        userFirst.count != userSecond.count { // char is eqeual, return long one
                return userFirst.count > userSecond.count ? true : false
            } else if userFirst.countNumberOfOccurrences(character: char) == userSecond.countNumberOfOccurrences(character: char) &&
                        userFirst.count == userSecond.count {// length is equeal return alphabetically
                return userFirst < userSecond ? true : false
            } else { // return second one
                return false
            }
        })
        hipoData[0].members = members
        PersistenceManager.save(hipoMembers: hipoData)

        tableView.reloadData()
    }

Author

hipointernship's People

Contributors

faacar avatar

Watchers

 avatar

Forkers

cengizhantomak

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.