Post

Replies

Boosts

Views

Activity

Reply to iOS voiceover for multiline input field
You can do the something natively in swiftUI without using UIKit. See here:https://developer.apple.com/documentation/swiftui/textfield/focused(_:equals:) struct LoginForm { enum Field: Hashable { case usernameField case passwordField } @State private var username = "" @State private var password = "" @FocusState private var focusedField: Field? var body: some View { Form { TextField("Username", text: $username) .focused($focusedField, equals: .usernameField) SecureField("Password", text: $password) .focused($focusedField, equals: .passwordField) EmptyView()                   .emptyState(focusedField == .username) {                           Text("Please enter a user name.")                                 .foregroundColor(.red)                                 .font(.footnote)                         } Button("Sign In") { if username.isEmpty { focusedField = .usernameField } else if password.isEmpty { focusedField = .passwordField } else { handleLogin(username, password) } } } } } struct EmptyStateViewModifier<EmptyContent>: ViewModifier where EmptyContent: View {     var isEmpty: Bool     let emptyContent: () -> EmptyContent     func body(content: Content) -> some View {         if isEmpty {             emptyContent()         } else {             content         }     } } extension View {     func emptyState<EmptyContent>(_ isEmpty: Bool,                                     emptyContent: @escaping () -> EmptyContent) -> some View where EmptyContent: View {         modifier(EmptyStateViewModifier(isEmpty: isEmpty, emptyContent: emptyContent))     } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’22
Reply to When I try to pass parameter to @FetchRequest, how to solve?
Best to use: lazy var accountType = "Account" @FetchRequest( sortDescriptors: [NSSortDescriptor(keyPath: \.displayOrder, ascending: true)] , predicate: NSPredicate(format: "(hidden < %@) AND (type == %@)", argumentArray: [1, accountType]) , animation: .default ) private var items: FetchedResults<JMAccount> or @FetchRequest( sortDescriptors: [NSSortDescriptor(keyPath: \.displayOrder, ascending: true)] , predicate: NSPredicate(format: "(hidden < %@) AND (type == %@)", argumentArray: [1, "Account"]) , animation: .default ) private var items: FetchedResults<JMAccount>
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’22
Reply to iOS voiceover for multiline input field
Still not relying on UIKit directly you can still make this a pure SwiftUI implementation by using a SwiftUI TextEditor and FocusValue & FocusBinding for iOS 14+ to do what FocusState is doing at iOS 15+. https://swiftwithmajid.com/2021/03/03/focusedvalue-and-focusedbinding-property-wrappers-in-swiftui/
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’22
Reply to How do I use NotificationCenter in mac catalyst to detect and connect an external display?
https://developer.apple.com/documentation/uikit/uiscreen/1617812-screens UIScreen.screens Discussion The returned array includes the main screen plus any additional screens connected to the device. The main screen is always at index 0. Not all devices support external displays. Currently, external displays are supported by iPhone and iPod touch devices with Retina displays and iPad. Older devices, such as the iPhone 3GS do not support external displays. didConnectNotification This notification is posted when a new screen is connected to the device.  Discussion Connection notifications are not sent for screens that are already present when the application is launched. The application can instead use the screens method to get the current set of screens at launch time. The object of the notification is the UIScreen object representing the new screen. There is no userInfo dictionary.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’22
Reply to ContentView error
Just make sure it has a target selected under target membership:
Topic: Business & Education SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to iOS OS Human user interface.
It's not illegal for a site to ask for an email, it is good judgement to know when not to provide it. But the site in question is a localization services company used by many.
Replies
Boosts
Views
Activity
Mar ’22
Reply to Flutter ios app Can't connect to server backend (endpoint)
Remove see what happens <key>NSExceptionMinimumTLSVersion</key> 12 <string>TLSv1.0</string>
Replies
Boosts
Views
Activity
Mar ’22
Reply to WatchOS 8.5 & iPad 15.4 Release notes
Hi @Jason, The url issue is still there, see below.
Replies
Boosts
Views
Activity
Mar ’22
Reply to Reporter is currently unavailable.
@Apples' idmas.apple.com server is running kinda slow so even though everything is green here: https://www.apple.com/support/systemstatus/
Replies
Boosts
Views
Activity
Mar ’22
Reply to The app crashes in the App Store when operating on iPhone with iOS v15.2/15.3.1.
If appears that after app launch, a view controller is being presented leading up to the crash
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to iOS voiceover for multiline input field
You can do the something natively in swiftUI without using UIKit. See here:https://developer.apple.com/documentation/swiftui/textfield/focused(_:equals:) struct LoginForm { enum Field: Hashable { case usernameField case passwordField } @State private var username = "" @State private var password = "" @FocusState private var focusedField: Field? var body: some View { Form { TextField("Username", text: $username) .focused($focusedField, equals: .usernameField) SecureField("Password", text: $password) .focused($focusedField, equals: .passwordField) EmptyView()                   .emptyState(focusedField == .username) {                           Text("Please enter a user name.")                                 .foregroundColor(.red)                                 .font(.footnote)                         } Button("Sign In") { if username.isEmpty { focusedField = .usernameField } else if password.isEmpty { focusedField = .passwordField } else { handleLogin(username, password) } } } } } struct EmptyStateViewModifier<EmptyContent>: ViewModifier where EmptyContent: View {     var isEmpty: Bool     let emptyContent: () -> EmptyContent     func body(content: Content) -> some View {         if isEmpty {             emptyContent()         } else {             content         }     } } extension View {     func emptyState<EmptyContent>(_ isEmpty: Bool,                                     emptyContent: @escaping () -> EmptyContent) -> some View where EmptyContent: View {         modifier(EmptyStateViewModifier(isEmpty: isEmpty, emptyContent: emptyContent))     } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to When I try to pass parameter to @FetchRequest, how to solve?
Best to use: lazy var accountType = "Account" @FetchRequest( sortDescriptors: [NSSortDescriptor(keyPath: \.displayOrder, ascending: true)] , predicate: NSPredicate(format: "(hidden < %@) AND (type == %@)", argumentArray: [1, accountType]) , animation: .default ) private var items: FetchedResults<JMAccount> or @FetchRequest( sortDescriptors: [NSSortDescriptor(keyPath: \.displayOrder, ascending: true)] , predicate: NSPredicate(format: "(hidden < %@) AND (type == %@)", argumentArray: [1, "Account"]) , animation: .default ) private var items: FetchedResults<JMAccount>
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to iOS voiceover for multiline input field
Still not relying on UIKit directly you can still make this a pure SwiftUI implementation by using a SwiftUI TextEditor and FocusValue & FocusBinding for iOS 14+ to do what FocusState is doing at iOS 15+. https://swiftwithmajid.com/2021/03/03/focusedvalue-and-focusedbinding-property-wrappers-in-swiftui/
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to swiftui may be missing as an ancestor of this view.
Cannot use it like that it will become a nested reference onto itself.             LocationsView()                 .environmentObject(vm) // Any child view will have access to this environment object by using  @EnvironmentObject var vm: LocationsViewModel
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to swiftui may be missing as an ancestor of this view.
You really don't needed it there because it is private
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to What is the replacement for OSAtomicCompareAndSwap32Barrier?
This is a c++ method of the atomic includes. You will have to probably implement an Objective/C++ wrapper around the method & then export it to swift via bridging file: atomic: references https://www.cplusplus.com/reference/atomic/atomic/
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to Swift: EXC_BAD_ACCESS when using nil-coalescing on optional closures [Xcode 3.3 (13E113)]
No crashes on Xcode 13.3 playground - it just locks the IDE up after a few runs.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to Swift Code Example using map inside of forEach
Is this homework?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to How do I use NotificationCenter in mac catalyst to detect and connect an external display?
https://developer.apple.com/documentation/uikit/uiscreen/1617812-screens UIScreen.screens Discussion The returned array includes the main screen plus any additional screens connected to the device. The main screen is always at index 0. Not all devices support external displays. Currently, external displays are supported by iPhone and iPod touch devices with Retina displays and iPad. Older devices, such as the iPhone 3GS do not support external displays. didConnectNotification This notification is posted when a new screen is connected to the device.  Discussion Connection notifications are not sent for screens that are already present when the application is launched. The application can instead use the screens method to get the current set of screens at launch time. The object of the notification is the UIScreen object representing the new screen. There is no userInfo dictionary.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’22