s24 MO1013 IOS final project - The Swift Application
How to hand this in:
Do this work in Xcode or an ONLINE Swift IDE
Put all your code and screen shots illustrating the working project into a Word Document named as a Student Name Student ID and upload to Google Classroom.
Here is the project requirement description for the Library Swift model:
Project: Swift Library Management System
Objective: Develop a command-line Swift application to manage a library system. The system should handle books, patrons, and basic library operations.
Key Components:
Book:
Properties: title, author, ISBN, publication year, genre, availability status
Functionality: check out, check in, display information
Patron:
Properties: ID, name, contact information, list of checked out books
Functionality: check out book, return book, display borrowed books
Display patron information, including currently borrowed books
Checkout System:
Allow patrons to check out available books
Implement a limit on the number of books a patron can borrow (e.g., 5 books maximum)
Set a due date for borrowed books (e.g., 14 days from checkout)
Return System:
Process book returns
Calculate and apply late fees if the book is overdue (e.g., $0.25 per day)
Reporting:
Generate a report of all overdue books
List most popular books (most frequently borrowed)
Show patrons with outstanding fines
Data Persistence:
Implement basic data persistence (e.g., save and load library state from a file)
Technical Requirements:
Use Swift structs or classes to model Books, Patrons, and the Library
Implement appropriate methods for each struct/class to handle required functionality
Use Swift's built-in data structures (Arrays, Dictionaries) to manage collections of books and patrons
Utilize Swift's error handling mechanisms for operations that might fail (e.g., checking out an unavailable book)
Implement a simple command-line interface for user interaction
Follow Swift best practices and conventions for naming and code organization
Include comments to explain complex logic or algorithms
Implement basic unit tests for core functionality
Optional Enhancements:
Implement a reservation system for currently checked-out books
Add a recommendation system based on a patron's borrowing history
Include a simple authentication system for patrons and librarians
Implement more advanced search capabilities (e.g., fuzzy matching for titles/authors)
Deliverables:
Swift source code files
README file with instructions on how to run the application
Sample data file (if using file-based persistence)
Brief documentation outlining the structure of the code and any important design decisions
This project will help demonstrate your understanding of Swift fundamentals, including structs/classes, protocols, error handling, and working with collections, while also providing a practical application that can be extended in various ways.
Here is a starter template: Do my your own work and refer to this only as needed for ideas:
Here's a starter Swift solution framework for the Library Management System based on the requirements. This code provides a command-line interface for interacting with the library system:
import Foundation
// MARK: - Models
struct Book: Codable {
let isbn: String
var title: String
var author: String
var publicationYear: Int
var genre: String
var isAvailable: Bool = true
var dueDate: Date?
mutating func checkOut() {
isAvailable = false
dueDate = Calendar.current.date(byAdding: .day, value: 14, to: Date())
}
mutating func checkIn() {
isAvailable = true
dueDate = nil
}
}
struct Patron: Codable {
let id: String
var name: String
var contactInfo: String
var checkedOutBooks: [String] // ISBNs of checked out books