Skip to content

Instantly share code, notes, and snippets.

Avatar

Pritesh Shah priteshshah1983

View GitHub Profile
@priteshshah1983
priteshshah1983 / lenses.swift
Last active Nov 29, 2017
Lenses - Re-imagined with Swift 4
View lenses.swift
// Motivation:
// http://chris.eidhof.nl/post/lenses-in-swift/
// https://www.youtube.com/watch?v=ofjehH9f-CU&feature=youtu.be
protocol Changeable {
func changed<A>(changes: [KeyPath<Self, A>: A]) -> Self
}
extension Changeable {
func changed<A>(changes: [KeyPath<Self, A>: A]) -> Self {
View gist:4680264
I was referring to this code:
// This is of the form: TEAMID.mSSO
#define kmSSOKeychainGroup @"3Q4M6DQ9WM.mSSO"
which is used here:
[keychainSearch setObject:kmSSOKeychainGroup forKey:(id)kSecAttrAccessGroup]; // inform the search that we're using the shared keychain
The use case I was talking about: I want to create a static library with the keychain stuff for two customers with team ids: TEAMID1 and TEAMID2.
I would have to somehow read the appropriate TEAMID from within the app which contains the static library. One option could be to have the customer define the TEAMID in a .plist file or something. But, it would be nice if I could just read the TEAMID during runtime.
You can’t perform that action at this time.