This file contains hidden or 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
| enum SFSymbols { | |
| static let location = UIImage(systemName: "mappin.and.ellipse") | |
| static let repos = UIImage(systemName: "folder") | |
| static let gists = UIImage(systemName: "text.alignleft") | |
| static let followers = UIImage(systemName: "heart") | |
| static let following = UIImage(systemName: "person.2") | |
| } |
This file contains hidden or 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
| // | |
| // DateUtil.swift | |
| // DrinkSum | |
| // | |
| // Created by Greg Eales on 5/11/20. | |
| // | |
| import Foundation | |
| struct DateUtil { | |
| static func getModifiedDate(date: Date, currentDate: Date) -> String { |
This file contains hidden or 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
| private func setDateFromSelection() { | |
| let monthNumber = getMonthNumberFromName(name: month) | |
| let timeComponents = Calendar.current.dateComponents( | |
| [.hour, .minute, .second, .nanosecond], from: selectedDate) | |
| let dateComponents = DateComponents( | |
| year: year, | |
| month: monthNumber, | |
| day: day, | |
| hour: timeComponents.hour, |
This file contains hidden or 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
| // | |
| // SwipeableModifier.swift | |
| // DrinkSum | |
| // | |
| // Created by Greg Eales on 22/12/20. | |
| // | |
| import SwiftUI | |
| struct Swipeable<V>: ViewModifier where V: View { |
This file contains hidden or 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
| # Setup plotting | |
| import matplotlib.pyplot as plt | |
| from learntools.deep_learning_intro.dltools import animate_sgd | |
| plt.style.use('seaborn-whitegrid') | |
| # Set Matplotlib defaults | |
| plt.rc('figure', autolayout=True) | |
| plt.rc('axes', labelweight='bold', labelsize='large', | |
| titleweight='bold', titlesize=18, titlepad=10) | |
| plt.rc('animation', html='html5') |
This file contains hidden or 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 SwiftUI | |
| func convertViewToData<V>(view: V, size: CGSize, completion: @escaping (Data?) -> Void) where V: View { | |
| guard let rootVC = UIApplication.shared.windows.first?.rootViewController else { | |
| completion(nil) | |
| return | |
| } | |
| let imageVC = UIHostingController(rootView: view.edgesIgnoringSafeArea(.all)) | |
| imageVC.view.frame = CGRect(origin: .zero, size: size) |
This file contains hidden or 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 SwiftUI | |
| import UniformTypeIdentifiers | |
| struct GridData: Identifiable, Equatable { | |
| let id: String | |
| } | |
| //MARK: - Model | |
| class Model: ObservableObject { |
This file contains hidden or 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
| for i in *.svg ; do rsvg-convert -d 500 -w 300 "$i"> "$i".png ; done |
This file contains hidden or 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
| // MARK: - Emoji Packs | |
| extension Emoji { | |
| private func getEmojiFileName(for pack: String) -> String { | |
| let strArr = codePoints | |
| .compactMap({ String(format:"%04X", UInt32($0)) }) | |
| .joined(separator: "-") | |
| .lowercased() | |
| return strArr + ".svg" | |
| } |
This file contains hidden or 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
| func getDocumentsDirectory()-> URL { | |
| let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) | |
| let documentsDirectory = paths[0] | |
| return documentsDirectory | |
| } | |
| // MARK: - Core Data stack | |
| lazy var persistentContainer: NSPersistentContainer = { |