Post

Replies

Boosts

Views

Activity

Reply to 我的账号登录不了xcode
Can't you find which device is ** *** *02 ? If that may help: https://stackoverflow.com/questions/72633166/getting-device-is-already-associated-with-other-accounts-the-apple-developer-pr 您不能找到哪个设备是 ** *** *02 吗? 如果有帮助的话: https://stackoverflow.com/questions/72633166/getting-device-is-already-associated-with-other-accounts-the-apple-developer-pr
Mar ’24
Reply to new i phone battery drains every 4 to 5 minutes 1%
That's not a question for this forum, you'd better go to support forum: https://discussions.apple.com/welcome What iPhone 13 ? Pro Max ? Pro ? standard ? mini ? Are you running apps, having phone call, watch video ? Is GPS active ? 1% every 5 minutes means an autonomy of about 8 hours. Which is normal in case of heavy use. Here are some figures: https://www.igen.fr/iphone/2021/09/lexcellente-autonomie-des-iphone-13-en-video-125507 Using the iPhones with demanding applications (TikTok, Camera, Instagram, games): just under 10 hours of battery life (9 hours and 52 minutes, to be precise) with the iPhone 13 Pro Max - unprecedented! The iPhone 13 Pro provides 8 hours 17 minutes, the iPhone 13 7 hours and 45 minutes, the iPhone 13 mini 6 hours and 26 minutes.
Topic: App & System Services SubTopic: Hardware Tags:
Mar ’24
Reply to Disable AutoFill option in UITextField or have control over the text which is being pasted using that option.
Could you show the code, to see exactly what you are doing ? I would do as follows: declare an IBAction @IBAction func editingTestField(_ sender: UITextField) { if conditionOKl { print("OK") } else { // Then, discard the change sender.text = "" } } In Connections inspector, connect the TextField 'Editing changed' 'sent events' to this IBAction: This clears the complete TextField. If you want to preserve content before cancelling autoFill, you should save the current content of TextField and use it instead of ""
Topic: UI Frameworks SubTopic: UIKit Tags:
Mar ’24
Reply to Firing a Timer & Resigning the keyboard after a number of characters have been entered(19)
I observe the same behaviour on simulator, only dismiss after char 20. How do you test on simulator ? With physical keyboard or software keyboard (you should) ? This is not the complete func textField() (we do not see all return). Please show it. Could you add a log, to see what's happening ? if textField == userInputTextField { print("Count", userInputTextfield.text?.count) Could you also try to change userInputTextfield to textField here // Mark check the condition to not exceed 19 chars if let characterCount = textField.text?.count { I made it work by changing as follows: if let characterCount = userInputTextfield.text?.count { // CHECK FOR CHARACTER COUNT IN TEXT FIELD if characterCount >= 18 { // RESIGN FIRST RERSPONDER TO HIDE KEYBOARD // Should test that string is a valid final char if string.count == 1 && string.first!.isNumber { userInputTextfield?.text = (userInputTextfield?.text)! + string return textField.resignFirstResponder() } else { return false } } }
Topic: Programming Languages SubTopic: Swift Tags:
Feb ’24
Reply to SwiftUI is pressing both buttons in a List
I reproduced the behaviour you described. Apparently, that's a long lasting issue: https://developer.apple.com/forums/thread/651572 More insight here, even though does not explain fully the cause: https://stackoverflow.com/questions/70399810/buttons-in-swiftui-list-foreach-view-trigger-even-when-not-tapped It also seems VStack is causing a problem, just as if the tap in button was passed to VStack and then to all…. The same occurs when you tap in VStack outside of buttons. I simplified to show: struct ContentView: View { var body: some View { List { // SectionArea(title: "Section One", height: 176, horizontalPadding: 0, roundCorners: (0, 0, 0, 0)) { // VStack { Button { print("Pressed Button One") // fullScreenViewChoice = .optionOne // showSubView.toggle() } label: { HStack { Text("Button One") Spacer() Image(systemName: "chevron.right") } } .frame(height: 40) .background(.red) // Divider() Button { print("Pressed Button Two") // fullScreenViewChoice = .optionTwo // showSubView.toggle() } label: { HStack { Text("Button Two") Spacer() Image(systemName: "chevron.right") } } .frame(height: 40) .background(.blue) // Divider() // } // } } .listStyle(.plain) .listRowSpacing(0) } } Sometimes, working with SwiftUI is like painting with boxing gloves…
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’24
Reply to Missing argument for parameter 'from' in call
First, please use code formatter : // InventoryManager.swift import Foundation class InventoryManager { static let shared = InventoryManager() private let key = "inventory" func saveInventory(_ inventory: Inventory) { if let encoded = try? JSONEncoder().encode(inventory) { UserDefaults.standard.set(encoded, forKey: key) } } func loadInventory() -> Inventory { if let data = UserDefaults.standard.data(forKey: key), let decoded = try? JSONDecoder().decode(Inventory.self, from: data) { return decoded } return Inventory() // <-- HERE } } // ContentView.swift import Foundation import SwiftUI struct ContentView: View { @State private var inventory: Inventory = Inventory() // <-- HERE var body: some View { TabView { Please show how Inventory is declared. You have probably defined an init(from:), which is thus expected at declaration. Here is a toy example: struct Inventory { var value: Int init() { value = 10 } init(from x: Int) { value = x } } When you call @State private var inventory = Inventory() Without init(), you get the error.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’24