Post

Replies

Boosts

Views

Activity

Enterprise SSO Extension for iOS
Hi I've built an SSO extension for my app. Now I would like to update the authsrv:login.myhost.com with additional associated domains generated by the MDM. The video here at 9:10 mark references the MDM associated domain ApplicationAttributes for iOS as the way to go. https://developer.apple.com/videos/play/tech-talks/301/ Is it just a matter of including: com.apple.developer.associated-domains.mdm-managed=YES in the entitlement file for both the app and the extension and having the MDM push down something like this in the profile? <dict> <key>AssociatedDomains</key> <array> <string>authsrv:login.myhost2.com</string> </array> </dict> Appreciate any guidance.
0
0
1.1k
Feb ’22
Array of Protocols and Subscript
Hi I have an array of protocols and would like to retrieve items from the array based on an enum. Something like this: enum ServiceType: String {    case car    case boat } protocol ServiceDescriptor {    var contact: String { get }    var type: ServiceType { get } } struct CarService: ServiceDescriptor {    let contact: String    let type: ServiceType } struct BoatService: ServiceDescriptor {    let contact: String    let type: ServiceType } class Repair {     init(allowedRepairs: [ServiceDescriptor]) {         self.allowedRepairs = allowedRepairs     }     let allowedRepairs: [ServiceDescriptor]     subscript(type: ServiceType) -> ServiceDescriptor? {        get {            return allowedRepairs.first(where: { $0.type == type })        }     } } let carService = CarService(contact: "Fred", type: .car) let boatService = BoatService(contact: "Jane", type: .boat) let repair = Repair(allowedRepairs: [carService, boatService]) print(repair.allowedRepairs[type: ServiceType.boat]). // error I end up with errors in Playgrounds as: no exact matches in call to subscript  found candidate with type '(ServiceType) -> Array.SubSequence' (aka '(ServiceType) -> ArraySlice< ServiceDescriptor >') The following works: print(repair.allowedRepairs[0]) I'm obviously coming about this the wrong way, I wanted to avoid a dictionary i.e let allowedRepairs: [ServiceType: ServiceDescriptor] because that would lend itself to assigning the wrong ServiceDescriptor to a ServiceType and it kinda duplicates the data. Is there a another way to have a custom argument in subscript instead of int? Many thanks
3
0
1.6k
Apr ’22
Change Navigation Text Title Color on Different SwiftUI Views
Hi I reviewed this post: How to change navigation title color in swiftUI This seems to work fine if the intention is to apply the title color across an application. I would like to apply a different text title color selectively depending on the View being shown. And in some instances revert back to the color depending on the light and dark themes. Same result occurs using a viewmodifier or simply using onAppear and onDisappear with the title color is applied to all views. And if you do modify it in onDisappear, when you navigate back to another view which changes the color onAppear it has the same color as the previous view. The only way I've found this to work is using UIViewControllerRepresentable and handling the viewWillAppear and viewWillDisappear something like this: NavigationBarView( viewWillAppear: { nav in nav.navigationBar.largeTitleTextAttributes = [.foregroundColor: UIColor.white] }, viewWillDisappear: { nav in nav.navigationBar.largeTitleTextAttributes = nil } ) Has anyone been successful in getting a different title text color to apply to different views using a modifier or onAppear and onDisappear? Appreciate any guidance.
1
0
2k
Apr ’24