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
// | |
// ExoModelFirebase.swift | |
// | |
import Foundation | |
import FirebaseDatabase | |
class ExoModelFirebase: ObservableObject { | |
var ref = Database.database().reference() |
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 Fluent | |
import Vapor | |
func routes(_ app: Application) throws { | |
let userController = UserController() | |
let basicGroup = app.grouped(User.authenticator()) | |
.grouped(User.guardMiddleware()) | |
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 Fluent | |
import Vapor | |
struct UserController { | |
func create(req: Request) throws -> EventLoopFuture<User> { | |
let receivedData = try req.content.decode(User.Create.self) | |
let user = try User(name: receivedData.name, | |
email: receivedData.email, | |
passwordHash: Bcrypt.hash(receivedData.password)) | |
return user.save(on: req.db).transform(to: user) |
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 | |
struct NewView: View { | |
@State var showSetting = false | |
//MARK: Properties | |
@ObservedObject var session = ActivityModelFirebase() | |
var body: some View { | |
NavigationView{ | |
ScrollView { |
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
struct ListRowView: View { | |
var activity: ActivityModel | |
var body: some View { | |
NavigationLink( | |
destination: DetailVIew(activity: activity), | |
label: { | |
CardView(item: activity) | |
}) | |
} |
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 | |
struct CardView: View { | |
var item: ActivityModel | |
var body: some View { | |
VStack { | |
URLImage(url: item.image) | |
Text(item.heading) | |
.font(Font.system(size: 20)) |
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 Combine | |
class ImageLoader: ObservableObject { | |
var downloadedImage: UIImage? | |
let didChange = PassthroughSubject<ImageLoader?, Never>() | |
func load(url: 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
var birthDate = document.getElementById("id"); | |
var format = "mm/dd/yyyy"; | |
var match = new RegExp(format | |
.replace(/(\w+)\W(\w+)\W(\w+)/, "^\\s*($1)\\W*($2)?\\W*($3)?([0-9]*).*") | |
.replace(/m|d|y/g, "\\d")); | |
var replace = "$1/$2/$3$4" | |
.replace(/\//g, format.match(/\W/)); | |
function format(target) |
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
UIView.animate(withDuration: 0.5, animations: { | |
button.transform = CGAffineTransform(rotationAngle: (CGFloat(Double.pi))) | |
}) { (isAnimationComplete) in | |
// Nested Block | |
UIView.animate(withDuration: 0.5) { | |
button.transform = CGAffineTransform(rotationAngle: (CGFloat(Double.pi * 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
override func prepare(for segue: UIStoryboardSegue, sender: Any?) { | |
if let tabbarcontroller = segue.destination as? UITabBarController { | |
let navigation = tabbarcontroller.viewControllers?.first as! UINavigationController | |
let vc = navigation.viewControllers.first as! Vc1ViewController | |
vc.la = "Navigation ok" | |
} | |
} |