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
uniqueValues = Array(Set(uniqueValues)) |
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
class ParseLayer { | |
var categoriesDelegate: CategoriesDelegate? | |
var categories: [String:PFObject] = [:] | |
//class | |
//let query = PFQuery(className: "Categories") | |
func getAllCategories() { | |
let query = PFQuery(className: "Categories") | |
query.fromLocalDatastore() | |
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 | |
import PlaygroundSupport | |
PlaygroundPage.current.needsIndefiniteExecution = true | |
func async<T>(_ executable: @escaping @autoclosure () -> T, _ priority: DispatchQoS.QoSClass = DispatchQoS.QoSClass.default, completion: @escaping (T) -> Void) { | |
DispatchQueue.global(qos: priority).async { | |
let result = executable() | |
DispatchQueue.main.async { |
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
mport Foundation | |
class DownloadManager { | |
var delegate: HavingWebView? | |
var gotFirstAndEnough = true | |
var finalURL: NSURL?{ | |
didSet{ | |
if finalURL != nil { |
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
// | |
// Model.swift | |
// KidSpace | |
// | |
// Created by October Hammer on 4/19/17. | |
// Copyright © 2017 Ocotober Hammer. All rights reserved. | |
// | |
import Foundation | |
import Parse |
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
if pfCategories.count > 0 { | |
//Получаю 1-ю запись, с самой большой картинкой. Хочу сначала вытащить ее, и только потом обрабатывать последовательно остальные записи | |
let category = Category(pfCategories[0].objectId!, name: pfCategories[0]["name"] as! String)//по сути я создаю новый инстанс | |
category.url = pfCategories[0]["URL"] as? String | |
if let picture = pfCategories[0].value(forKey: "picture") as? PFFile { | |
category.retrieveImage(from: picture) {(_ imageData: Data?) -> Void in | |
category.pictureData = imageData//вот они, данные картинки | |
catSelection?.append(category)//добавил | |
//==== | |
let category = Category(pfCategories[1].objectId!, name: pfCategories[1]["name"] as! String)//по сути я создаю новый инстанс |
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
// | |
// Model.swift | |
// KidSpace | |
// | |
// Created by October Hammer on 4/19/17. | |
// Copyright © 2017 Ocotober Hammer. All rights reserved. | |
// | |
import Foundation | |
import Parse |
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 UIKit | |
//объявляем протокол | |
protocol HavingMenuItems { | |
//пишу прямо в текстовом редакторе, могут быть ошибки, исправим | |
//твой протокол - это просто класс, у которого будет вот такая переменная такого типа | |
var menuItems: [MenuItem] { | |
get {} |
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
Например такая строка из терминала: | |
curl -X GET \ | |
-H "X-Parse-Application-Id: ad383bxkAmwAgKgPEqZHjewleWi2bLmNTlctBuky" \ | |
-H "X-Parse-Master-Key: qTJ3eatgZppvAWqkb82WsCoqG9MqRog2MBXqRHHv" \ | |
-G \ | |
--data-urlencode "where={\"parentID\":{\"\$exists\":false}}" \ | |
https://parseapi.back4app.com/classes/category | |
Возвращает приемлемую для меня JSON-строку(ниже) |
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
class MainController: UINavigationController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
self.navigationBar.isTranslucent = false | |
self.navigationBar.tintColor = UIColor.blue | |
let fontDictionary = [ NSForegroundColorAttributeName:UIColor.red ] | |
self.navigationBar.titleTextAttributes = fontDictionary | |
self.navigationBar.setBackgroundImage(imageLayerForGradientBackground(), for: UIBarMetrics.default) | |
OlderNewer