Post

Replies

Boosts

Views

Activity

Reply to What does 'Extra arguments at positions in call' mean?
So my question is, why am I receiving the above error and what can I do to resolve it? It depends on many things, How tableViewData is declared and used How cellData(opened:title:sectionData) is defined My rough guess is something like this: self.tableViewData = [cellData(opened: false, title: "Item 1", sectionData: [productName, listingPrice, briefDescription, productURL, activeUntil])] If this is not what you want, you may need to show more info.
Topic: UI Frameworks SubTopic: UIKit Tags:
Apr ’21
Reply to ITMS-90725: SDK Version Issue - submitting with Xcode 11 before Aprin 26
Is there a chance that my update will be rejected event if it is already pushed to AppStoreConnect? It is not clear what submit means in the Apple's News, so you should better include Submit to Review is included. Even if you have some binaries uploaded to App Store Connect, they need to be built with Xcode 12 to Submit to Review after April 26, 2021.
Apr ’21
Reply to Releasing an App upgrade after changing the underlying technology
We also think it should be OK, but can't find any explicit mention of this kind of use case in any documentation.  You would never find it. Many rules describe what you cannot do, but none of them list up all the things what you can do. You should better mind if your app follows the App Store Review Guidelines and Human Interface Guidelines. Some of the app framework might be violating the guidelines.
Topic: App & System Services SubTopic: Core OS Tags:
Apr ’21
Reply to Assistant not opening the correct swift file
can't progress any further until I sort this out? You would never be able to progress any more unless you accept that you cannot go exactly as written in the book. Can you clarify what you have done with your storyboard? You have added a prototype cell into a tableView and set ExploreCell to the Custom Class of it? Or something else? You have no need to use .xib, but one thing sure is that you need to do something else than in the book.
Topic: Programming Languages SubTopic: Swift Tags:
Apr ’21
Reply to Omit items from List without leaving a gap in produced list
Update here is the code: Thanks for showing your code. Seems you are using very unique naming rules. Which is forcing readers make much effort to read your code. You should better improve it, but that's another issue. the list has large gaps in it where other currencies which aren't favourited would normally be. That's the expected result from your code, seems SwiftUI in your environment is working correctly. Why don't you use filter? Something like this: var body: some View { VStack{ HStack{ Toggle("Favourites only", isOn: $showFavs) } Divider() } List { ForEach(items.filter(myFilter)) { record in HStack{ VStack{ HStack{ Text(record.core_Country) Spacer() } HStack(alignment: .center){ Text(FLAGCODES[record.core_Code] ?? "") Text(record.core_Code) Text(record.core_Currency_Name) NavigationLink(destination: CurrencyDetail2(RowData: record)) { } } } } .frame(height: 50) } } .navigationBarTitle(Text("Exchange Rates"), displayMode: .inline) .listStyle(DefaultListStyle()) .navigationBarItems(trailing: Image(systemName:"antenna.radiowaves.left.and.right").resizable() .foregroundColor(FetchedRates.dataStatus)) } func myFilter(_ record: CURRENCIES) - Bool { return FetchedRates.faves.contains(record.core_Code) && showFavs }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’21
Reply to how to change view controllers through code on xcode swift
i am currently using this line of code on my logout function What is your logout function? You may need to clarify what view controllers are involved in the situation and name them. once my function has executed Please clarify what is your function. so is there a way to close the opened view controller that was opened?  I think there is. Why don't you use dismiss? By the way, your question has nothing to do with the SwiftUI framework. Using the tag SwiftUI seems to be inappropriate.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’21
Reply to Run something before another thing
The completion handler isn't being called. Ideas? That would never happen. This thread is too old and too long, many readers would not visit old and long thread. Better start a new thread and show the complete code which can reproduce the issue you are facing.
Topic: UI Frameworks SubTopic: UIKit Tags:
Apr ’21
Reply to SwiftUI Rerun animation when property changes.
How about something like this? struct ContentView: View { @State private var status: String = "" var body: some View { VStack(spacing: 0) { Spacer() BackgroundView(status: $status) Spacer() Button(action: { if status == "1" { status = "2" } else if status == "2" { status = "3" } else { status = "1" } }, label: { Text("next status") }) Spacer() } .onAppear { status = "1" } } } struct BackgroundView: View { @Binding var status: String @State var isAnimating: Bool = false var body: some View { ZStack { Group { Image(systemName: "\(status).circle.fill") .resizable() .scaledToFit() .frame(width: 220) .foregroundColor(.red) } .scaleEffect(isAnimating ? 1.0 : 0, anchor: .top) } .onChange(of: status) {_ in isAnimating = false withAnimation(Animation.easeOut(duration: 0.4)) { isAnimating = true } } } } Your BackgroundView will animate as expected when isAnimating changes from false to true. So, do it onChange of status.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’21
Reply to SwiftUI passing Core Data between Views Error
Can you try something like this? struct ListView: View { @Environment(\.managedObjectContext) var viewContext @FetchRequest(sortDescriptors: []) var items: FetchedResultsItem @State var showEditItemSheet = false @State var itemToEdit: Item? var body: some View { List { ForEach(items) { item in ListItemView(item: item) .onTapGesture { itemToEdit = item showEditItemSheet.toggle() } } } .sheet(isPresented: $showEditItemSheet) { ListViewSheetContent(item: $itemToEdit, showEditItemSheet: $showEditItemSheet) } } } struct ListViewSheetContent: View { @Binding var item: Item? @Binding var showEditItemSheet: Bool var body: some View { EditItemView(item: item!, showEditItemSheet: $showEditItemSheet) } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’21
Reply to Changing UITabBar item image on selected and unselected state for Three Tabs but getting error
You can modify the properties of each UITabBarItem: if let tabBarItem1 = self.tabBarController?.tabBar.items?[0] { tabBarItem1.title = "Myanmar" tabBarItem1.image = UIImage(systemName: "m.square.fill") tabBarItem1.selectedImage = UIImage(systemName: "m.square") } if let tabBarItem2 = self.tabBarController?.tabBar.items?[1] { tabBarItem2.title = "Singapore" tabBarItem2.image = UIImage(systemName: "s.square.fill") tabBarItem2.selectedImage = UIImage(systemName: "s.square") } if let tabBarItem3 = self.tabBarController?.tabBar.items?[2] { tabBarItem3.title = "Hyderabad" tabBarItem3.image = UIImage(systemName: "h.square.fill") tabBarItem3.selectedImage = UIImage(systemName: "h.square") }
Topic: UI Frameworks SubTopic: UIKit Tags:
Apr ’21
Reply to Simplify code with textfield and textview delegate methods?
This is what I do in some of my apps. Put all the textFields and textViews into a UIStackView, and add a proper constraint at the bottom. @IBOutlet weak var bottomConstraint: NSLayoutConstraint! override func viewDidLoad() { super.viewDidLoad() //... NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(_:)), name: UIResponder.keyboardWillShowNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(_:)), name: UIResponder.keyboardWillHideNotification, object: nil) } @objc func keyboardWillShow(_ notification: Notification) { print(notification) if let keyboardBounds = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue { bottomConstraint.constant = -keyboardBounds.height } } @objc func keyboardWillHide(_ notification: Notification) { if let _ = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue { bottomConstraint.constant = 0 } } It is a bit difficult to add a proper constraint to the bottom of a UIStackView if you are not accustomed to it, but once done, changing bottomConstraint would move up all the fields and they will not be hidden.
Topic: UI Frameworks SubTopic: UIKit Tags:
Apr ’21
Reply to MTLTexture -> CIImage -> CGImage crash on options not nil
What am I missing? Have you tried changing line 4 as follows? let options: [CIImageOption: Any] = [CIImageOption.colorSpace: CGColorSpace(name: CGColorSpace.linearSRGB)!] The doc of CIImageOption.colorSpace - https://developer.apple.com/documentation/coreimage/ciimageoption/1438131-colorspace says: The value you supply for this dictionary key must be a CGColorSpace data type. As you know CGColorSpace.linearSRGB is CFString, not CGColorSpace. There may be other parts affecting this behavior, so you may have other places to fix. But the value of options seems to be one thing you need to fix.
Topic: Programming Languages SubTopic: Swift Tags:
Apr ’21