Skip to content

Instantly share code, notes, and snippets.

@LinnierGames
Last active July 18, 2020 07:37
Show Gist options
  • Save LinnierGames/7c47c8ffbfc5db008adea2b4ad4421cb to your computer and use it in GitHub Desktop.
Save LinnierGames/7c47c8ffbfc5db008adea2b4ad4421cb to your computer and use it in GitHub Desktop.
protocol SchoolServiceDelegate: AnyObject {
func schoolServiceDidFinishFetching(_ service: SchoolService)
}
class SchoolService {
weak var delegate: SchoolServiceDelegate?
private(set) var nycHSList: [NYCHighSchool] = []
func fetchHighschoolStuff() {
// Move the code from fetchNYCHighSchoolInformation here (fetch, decode data into NYCHighSchool models, update nycHSList)
// Try using JSONDecoder() instead of JSONSerialization
// When finished, update nycHSList and notify the delegate
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment