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 AuthenticationServices | |
import Supabase | |
struct LoginView: View { | |
@State private var isSignedIn = false | |
@State private var signInError: Error? | |
@AppStorage("name") var currentUserName: String? | |
@AppStorage("userID") var signedInUserId: 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
func uploadImage() { | |
guard let inputImage = inputImage else { return } | |
isLoading = true | |
Task { | |
#if DEBUG && targetEnvironment(simulator) |
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 ContentView: View { | |
@Environment(\.scenePhase) var scenePhase | |
@State private var startOfToday = Calendar.current.startOfDay(for: Date.now) | |
@State private var timer: Timer? | |
var dateFormatter: DateFormatter { | |
let formatter = DateFormatter() |
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 Foundation | |
import SwiftUI | |
import UIKit | |
extension Color { | |
func brightness() -> Double { | |
// Assuming the color is RGB | |
let components = UIColor(self).cgColor.components! | |
return 0.299 * components[0] + 0.587 * components[1] + 0.114 * components[2] // Standard formula for brightness |
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
require("dotenv").config(); | |
const express = require("express"); | |
const axios = require("axios"); | |
const app = express(); | |
const port = 3000; | |
const TELEGRAM_TOKEN = process.env.TELEGRAM_BOT_TOKEN; | |
const CHAT_ID = process.env.TELEGRAM_CHANNEL_ID; | |
const TELEGRAM_API_URL = `https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendMessage`; |
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 Goal: Identifiable, Equatable { | |
var id = UUID() | |
var title: String | |
var iconName: String | |
} | |
import SwiftUI | |
struct ContentView: 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
import Foundation | |
import Network | |
class NetworkMonitor: ObservableObject { | |
private let monitor: NWPathMonitor | |
private let queue = DispatchQueue(label: "NetworkMonitor") | |
@Published var isConnected: Bool = true | |
init() { | |
monitor = NWPathMonitor() |
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
// | |
// HomeView.swift | |
// SwiftlyBase | |
// | |
// Created by Mario Saputra on 2024/01/09. | |
// | |
import SwiftUI | |
import SwiftUIKitView | |
import RubyAttribute |