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 SwiftUI | |
import Combine | |
class AppState: ObservableObject { | |
func reloadDashboard() { | |
(UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate)?.reloadDashboard() | |
} | |
} |
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
var window: UIWindow? | |
var contentView: ContentView? | |
var appState: AppState? | |
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |
if let windowScene = scene as? UIWindowScene { | |
let window = UIWindow(windowScene: windowScene) | |
self.window = window | |
reloadDashboard() | |
} |
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
struct GradientText: View { | |
let title: String | |
let colors = Gradient(colors: [Color.hexStringToColor(hex: "#FF0000"), | |
Color.hexStringToColor(hex: "#40B482")]) | |
var body: some View { | |
RadialGradient(gradient: colors, | |
center: .center, | |
startRadius: 0, | |
endRadius: 300) |
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
extension Color { | |
static func hexStringToColor (hex:String, opacity: Double = 1.0) -> Color { | |
var cString:String = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased() | |
if (cString.hasPrefix("#")) { | |
cString.remove(at: cString.startIndex) | |
} | |
if ((cString.count) != 6) { | |
return Color.gray | |
} | |
var rgbValue:UInt64 = 0 |
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 SwiftUI | |
extension Color { | |
static func hexStringToColor (hex:String, opacity: Double = 1.0) -> Color { | |
var cString:String = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased() | |
if (cString.hasPrefix("#")) { | |
cString.remove(at: cString.startIndex) | |
} | |
if ((cString.count) != 6) { | |
return Color.gray |
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
const char *sqlStatement = [query UTF8String]; | |
sqlite3_stmt *compiledStatement; | |
if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) { | |
// Loop through the results and add them to the feeds array | |
while(sqlite3_step(compiledStatement) == SQLITE_ROW) { | |
// Read the data from the result row | |
NSString *word = [NSString stringWithUTF8String:(char *)sqlite3_column_tcompiledStatement, | |
[arrayWords addObject:word]; | |
} | |
} |
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
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) | |
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) | |
#define IS_RETINA ([[UIScreen mainScreen] scale] >= 2.0) | |
#define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width) | |
#define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height) | |
#define SCREEN_MAX_LENGTH (MAX(SCREEN_WIDTH, SCREEN_HEIGHT)) | |
#define SCREEN_MIN_LENGTH (MIN(SCREEN_WIDTH, SCREEN_HEIGHT)) |