GalaxyPedia it's an app that allows you to search for a star wars characters, spaceships or planets.
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.
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.
• Search Textfield created by .searchable modifier
• Bottom bar (TabView)
• Picker with .segmented modifier
• 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
• Minimum Deployment version IOS 16.4
• Supported XCode version 14.3