Skip to content

Instantly share code, notes, and snippets.

@hisavali
hisavali / swift
Last active October 9, 2023 15:38
Parse: Use-case based on swift-parsing
import XCTest
import Parsing // https://github.com/pointfreeco/swift-parsing
struct ParsedData {
let key1: Int
let key2: UUID?
let key3: String
}
@hisavali
hisavali / BidirectionalStateChange.swift
Created July 27, 2021 14:41
SwiftUI: Using @binding, achieve two way state change
import SwiftUI
struct BadgeView: View {
@Binding var viewstate: String
var body: some View {
VStack {
Text(viewstate)
.padding()
Button("Tap: Child to parent") {
// Change made by child entity
@hisavali
hisavali / SketchSystems.spec
Last active August 5, 2019 15:55
Start-Landing*
Start-Landing*
tick -> Start
Start
tick -> AreYouHome
AreYouHome
yes -> StartIntro
no -> NeedToBeHome
StartIntro
NeedToBeHome
@hisavali
hisavali / 001Background
Last active August 29, 2015 14:13
NString comparsions operators -- CONTAINS/LIKE -- it doesn't work on NSData
Problem: Once encrypted values are stored as NSData in persistent store, if fetch takes place with NSPredicate which uses string (not basic) comparisons operators -- CONTAINS/LIKE -- it doesn't work for NSData.
Note: I have to stop having random values for 'iv' & 'salt' generationed in DataGenerator.m
Please find my code in files listed below. I have provided comments against working & non-working code.
Question: In order to fetch data, how to form sql query (predicate) with string operators 'like, contains or match' for encrypted data.