Post

Replies

Boosts

Views

Activity

UIApplication.willEnterForegroundNotification not fired when Notification Center puts app in background
Using addObserver func of NotificationCenter.default, subscribing to UIApplication.willEnterForegroundNotification does not work when the backgrounding is triggered from Notification Center (swipe down from top when app is active to get Notification Center).  It also seems that UIApplication.willResignActiveNotification is called twice, based on Print() logs, when Notification Center triggers the backgrounding. If you background the app via lock screen or manual swipe, or switch to another app, the UIApplication.willEnterForegroundNotification does get called, so it seems to be specific to Notification Center. UIApplication.willResignActiveNotification does fire correctly but then resuming the app never calls the appMovedToForeground func below: notificationCenter.addObserver(self, selector: #selector(appMovedToForeground), name: UIApplication.willEnterForegroundNotification,object: nil) occurs on: iOS 14.4.2, iPhone 11 & iOS 14.6, SE(2)
3
0
5.7k
Jul ’21
Attributed text, dynamic type and localization
I'm using nib files not Swift UI, and trying to get attributed text in a TextView to be localized as well as scale for accessibility - Dynamic Type specifically for larger fonts set in Settings -> Accessibility. I haven't found anything in the Apple documentation, but I'm assuming attributed text is not supported in localization or accessibility. Does SwiftUI address this somehow? The "scaling fonts automatically" docs from Apple only mention using plain text in IB. Has anyone found a workaround, fix or an elegant custom solution to handle this? 3rd party OSS framework?? My first thought is to build the attributable text programmatically, using localized strings, then scale up the font size programmatically based on PreferredContentSizeCategory from the traitCollectionDidChange() notification. TIA.
1
0
1.1k
Feb ’21
Button title and accessibility for fonts
Currently working on a medical at home testing app that has to comply with certain FDA guidelines for accessibility. Mainly, larger font sizes. I understand how Dynamic Type works and that seems to be working fine so far - however, when I add a UIButton to my nib and set its Title font to style "Title 3" (for example, so that it scales with System settings), the font scales up and becomes invisible because the button itself is not scaling. I end up with an ellipse for the button Title. Also, if the button did scale it would really impact the UI in terms of the design that I am coding to. Is there any best practice or guide for how to handle this? Should I just ignore button accessibility? Any tips or advice is appreciated.
2
0
2.0k
Jan ’21
Swift class can't see public swift class in binary XCFramework
I have an Objective-C project with Swift classes and a Swift bridging header. I also have a binary XCFramework included in the project which has its own Swift UIView classes. The XCFramweork's swift views are public, like public class ThisView: UIView {}. The problem is that in my main project, in any Swift class, I can't create an instance of ThisView() - Xcode complains "Cannot find ThisView in scope". I tried importing the name of the XCFramework at the top of the Swift class, but it does nothing. My Swift class can see obj-c code from the XCFramework via the bridging header imports, but not other Swift classes that are in the Framework. Is this due to the bridging header in the main project? Any other ideas? The framework is copied into the project's local directory, not using pod or carthage. TIA
0
0
944
Dec ’20
static library which can reference binary XCFramework
Hello - I want to include a binary XCFramework in a project which has a single static library target. The static library is a hard requirement, meaning it can't change from how it exists now. What I need to do is add an XCFramework (binary since we want the implementation code to be hidden / secure). From there I want to access the Framework code that's exposed via public headers, from my .swift files in my static library. I know that static libraries don't have any concept of Bundle or file system, so it seems to me that this is not possible. Any suggestions?
0
0
587
Dec ’20