Skip to content

Instantly share code, notes, and snippets.

View javalnanda's full-sized avatar
👨‍💻

Javal Nanda javalnanda

👨‍💻
View GitHub Profile
@javalnanda
javalnanda / ViewExtensions.swift
Created February 6, 2024 07:57
SwiftUI View Extensions
import SwiftUI
public extension View {
func fillMaxSize(alignment: Alignment = .center) -> some View {
frame(maxWidth: .infinity, maxHeight: .infinity, alignment: alignment)
}
func fillMaxWidth(alignment: Alignment = .center) -> some View {
frame(maxWidth: .infinity, alignment: alignment)
}
var fs = require('fs');
console.log("\n *START transformation* \n");
var content = fs.readFileSync("db.json");
var json = JSON.parse(content);
var docs = json.rows;
var newDocs = new Array();
docs.forEach(function(doc) {
var innerdoc = doc.doc;
delete innerdoc._rev;
newDocs.push(innerdoc);
import Foundation
// Enter your code here
//print("Enter str1")
var str1 = Array(readLine(strippingNewline: true)!.characters)
//print("Enter str2")
var str2 = Array(readLine(strippingNewline: true)!.characters)
var tempDelArr = [Character]()
var tempIndexArr = [Int]()
func fetchData(){
UIApplication.shared.isNetworkActivityIndicatorVisible = true
let apiUrl = "https://raw.githubusercontent.com/javalnanda/AlamofireObjectMapperSample/master/AOMsample.json"
Alamofire.request(apiUrl).validate().responseArray(keyPath: "result") { (response: DataResponse<[Project]>) in
UIApplication.shared.isNetworkActivityIndicatorVisible = false
switch response.result {
case .success:
self.projects = response.result.value ?? []
for project in self.projects {
print(project.name)
import Foundation
import ObjectMapper
class Project: NSObject, Mappable {
var projectId: Int?
var accountId: Int?
var dateCreated: Int?
var dateModified: Int?
var name: String?
{
"err": 0,
"result": [{
"id": 71930,
"account_id": 40869,
"status": "enabled",
"settings_data": {
"time_format": "12h",
"timezone": "US/Pacific",
"fingerprint_versions": {