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
override func viewWillAppear(_ animated: Bool) { | |
super.viewWillAppear(animated) | |
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(InformationController.counter), userInfo: nil, repeats: true) | |
questionArea.textColor = .white | |
let infoLayer = self.view.layer | |
infoLayer.cornerRadius = 20.0 | |
infoLayer.borderWidth = 10.0 | |
infoLayer.borderColor = UIColor.white.cgColor |
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
decks | |
deck_id | |
deck_description | |
deck_bg_front | |
deck_bg_back | |
deck_price | |
deck_color | |
cards | |
card_name | |
card_bg |
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
[ | |
{ | |
"id": 0, | |
"name": "comida", | |
"price": 0.99, | |
"description": "this is the description", | |
"deckImage": "this is a UIImage", | |
"deckBgImage": "this is a UIImage", | |
"bought": false, | |
"cards": [ |
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
let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] | |
// /Users/mindblown/Library/Developer/CoreSimulator/Devices/335D0FB4-A0FA-4373-8F9D-EC837D3404FC/data/Containers/Data/Application/D9986A43-592F-47E8-9D67-48C2639245E1/Documents | |
let imagePath = URL(fileURLWithPath: documentsPath + deckName + fileName) | |
// file:///Users/mindblown/Library/Developer/CoreSimulator/Devices/335D0FB4-A0FA-4373-8F9D-EC837D3404FC/data/Containers/Data/Application/EFEB1A98-30FC-4209-9FF9-20EC640EAA34/Documents/comida/PIA08653~small.jpg | |
// it creates and extra / in file:// |
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 checkForDecksDirectory() { | |
let fm = FileManager.default | |
let dirPath = fm.urls(for: .documentDirectory, in: .userDomainMask) | |
let docsURL = dirPath[0] | |
let docPath = docsURL.appendingPathComponent("decks").absoluteString | |
let deckPath = docsURL.appendingPathComponent("decks") | |
var isDir : ObjCBool = false | |
if fm.fileExists(atPath: docPath, isDirectory:&isDir) { |
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
// if directory exists skip | |
// else | |
//create directory | |
createDirectory(name: "cabecao/decks/comida/") | |
func createDirectory(name: String) { | |
let fm = FileManager.default | |
let dirPath = fm.urls(for: .documentDirectory, in: .userDomainMask) | |
let docsURL = dirPath[0] |
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
[ | |
{ | |
"id": 0, | |
"name": "comida", | |
"price": 0.99, | |
"description": "this is the description", | |
"deckImage": "https://images-assets.nasa.gov/image/PIA08653/PIA08653~small.jpg", | |
"deckBgImage": "https://images-assets.nasa.gov/image/PIA08653/PIA08653~small.jpg", | |
"bought": false, | |
"cards": [ |
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
class BusinessCategory < ApplicationRecord | |
validates_presence_of :name | |
has_many :jobs | |
has_many :business_industries, through: :jobs | |
end |
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
class UsersController < ApplicationController | |
def new | |
@business_categories = BusinessCategory.all | |
@user = User.new | |
respond_to do |format| | |
format.html | |
format.json { render :json => @business_categories } | |
end | |
end |
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
class Job < ApplicationRecord | |
has_one :user | |
end |