This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// see: https://www.youtube.com/watch?v=Y3t8e_rUyTk&list=PLwu90VQm-yTobHYmgVdvZu5sBdyPPxW9S and http://ladyandtech.blogspot.de/2016/03/swift-testing-with-xctest.html | |
import XCTest | |
@testable import YOUR_MODULE_NAME | |
class yourTestCase: XCTestCase { | |
override func setUp() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NotificationService.swift | |
// Service | |
// | |
// Created by Barbara Rodeker on 28/09/16. | |
// Copyright © 2016 Barbara Rodeker. All rights reserved. | |
// | |
import UserNotifications |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// An Observer class intended to show how KVO works on operations and queues | |
// | |
// Created by Barbara Rodeker on 3/3/16. | |
// | |
// This program is free software: you can redistribute it and/or modify | |
// it under the terms of the GNU General Public License as published by | |
// the Free Software Foundation, either version 3 of the License, or | |
// (at your option) any later version. | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// This is an implementation of an asynchronous operation subclass. | |
// BASED ON: ConcurrentOperation.swift: Created by Caleb Davenport on 7/7/14. | |
// The original implementation has been completed with specific links to the documentation in order | |
// to make sure all the guidelines for subclassing an async operation are followed and learn more about | |
// how it should be correctly implemented, as well as having links available to help our memory to remember all | |
// the requirements a subclass of NSOperation should fullfit when it runs asynchronously. | |
// | |
// From Apple Docs: | |
// If you are creating a concurrent operation, you need to override the following methods and properties at a minimum: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NotificationViewController.swift | |
// Content | |
// | |
// Created by Barbara Rodeker on 28/09/16. | |
// Copyright © 2016 Barbara Rodeker. All rights reserved. | |
// | |
import UIKit | |
import UserNotifications |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CoreDataStack.swift | |
// CoreDataShowcase | |
// | |
// Created by Barbara Rodeker on 31.10.17. | |
// | |
// THIS CLASS CONTAINS ALL THE REQUIRED PROPERTIES THAT NEED TO BE CREATED | |
// FOR CORE DATA AFTER NSPersistentContainer was added in IOS 10 | |
// | |
// SWIFT 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CoreDataStackTheOldWay.swift | |
// CoreDataShowcase | |
// | |
// Created by Barbara Rodeker on 24.09.17. | |
// | |
// THIS CLASS CONTAINS PROPERTIES THAT NEEDED TO BE | |
// CREATED FOR CORE DATA BEFORE THE EXISTENCE OF NSPERSISTENTCONTAINER (added in iOS10) | |
// | |
// SWIFT 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// example to show how to check if core data can infers a mapping model by itself | |
// do not forget to add the .momd to you model object package!!!! | |
// https://developer.apple.com/documentation/coredata/nsmappingmodel/1506468-inferredmappingmodelforsourcemod | |
// SWIFT 4 | |
if let previousModelURL = Bundle.main.url(forResource: "YOURMODELNAME.momd/YOURMODELVERSION 2", withExtension: "mom"), | |
let previousModel = NSManagedObjectModel(contentsOf: previousModelURL), | |
let currentModelURL = Bundle.main.url(forResource: "YOURMODELNAME.momd/YOURMODELVERSION 3", withExtension: "mom"), | |
let currentModel = NSManagedObjectModel(contentsOf: currentModelURL) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a persistent container with an specific description for the stores | |
private(set) lazy var container: NSPersistentContainer = { | |
let description = NSPersistentStoreDescription() | |
description.type = NSSQLiteStoreType | |
description.shouldInferMappingModelAutomatically = false | |
description.shouldMigrateStoreAutomatically = true | |
let container = NSPersistentContainer(name: CoreDataStackTheNewWay.modelName) | |
container.persistentStoreDescriptions = [description] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
// Extension on PropertyListSerialization to read an array from a property list file | |
extension PropertyListSerialization { | |
// Takes the name of the PLIST file to be read. Name must be provided without extension. | |
// returns an optional array if the file can be opened and parsed properly. | |
// - Parameters: | |
// - named String with the filename. No extension .plist needed | |
static func arrayFromPlist(named name: String) -> [Any]? { |
NewerOlder