Skip to content

Chokaaaa/SWAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

GalaxyPedia (Star Wars IOS app)

GalaxyPedia it's an app that allows you to search for a star wars characters, spaceships or planets.

Description

Application that allows you to search for a starwars characters, spaceships and planets when according picker is selected. This application allows you to save and store favorite characters localy on your device and showcase it in your favorites tab.

Architecture

This application has been created with MVVM architecture (ModelView-View-Model) which is the most popular architecture pattern for a small projects like that, but will still give you enough room if functionality will grow.

• Model has all necessary data or business logic needed to be used within the app

• View folder is responsible to store all of the views or reusable elements within the app.

• ModelView is responsible for a business logic between Model and the view trough the NSURLSession.

Features

• Search Textfield created by .searchable modifier

Simulator Screenshot - iPhone 14 Pro - 2023-09-05 at 16 39 48 Simulator Screenshot - iPhone 14 Pro - 2023-09-05 at 16 43 38

• Bottom bar (TabView)

Simulator Screenshot - iPhone 14 Pro - 2023-09-05 at 16 19 19

• Picker with .segmented modifier

Simulator Screenshot - iPhone 14 Pro - 2023-09-05 at 16 41 55

• NSURLSession request with a JSONDecoder response

   func getCharacterSearchResults(searchText : String = "", completion: @escaping (_ characters: [Character]) -> Void)  {
        guard let url = URL(string: "https://swapi.dev/api/people/?search=\(searchText)") else {
            
            print("Invalid URL")
            completion([Character]())
            return
        }
        
        URLSession.shared.dataTask(with: url) { data, response, error in
            
            if let error = error {
                print("Error is \(error.localizedDescription)")
                completion([Character]())
                return
            }
            
            guard let data = data else {
                print("invalid DATA")
                return
            }
            
            guard let charactersResults = try? JSONDecoder().decode(CharacterResults.self, from: data) else {
                completion([Character]())
                return
            }
            print("Character results \(charactersResults)")
            completion(charactersResults.results)
        }
        .resume()

CRUD functionality with Realm for favorites tab

Requirements

• Minimum Deployment version IOS 16.4

• Supported XCode version 14.3

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages