Post

Replies

Boosts

Views

Activity

update UIKit view when viewDidLayoutSubviewsCallback from swiftUI wrapper gets call
Hello team i notice that we have a problem in our app that every time the user opens a Textfield the app freezes when the keyboard appears, this behavior was tracked down and it's a UI breaking design on a UIView [this view it's expandable and is original size is 80] [when it gets expanded 206.33] this is the view code I change the colors to easy check the other's views created inside private lazy var sharedUIPlaybackView: UIView = { let containerView = UIView().withAutoLayout() let propertySearchCriteria = PropertySearchCriteriaBuilder(hotelSearchParameters: viewModel.hotelSearchParameters).criteria var swiftUIView: SwiftUIView<LodgingPlaybackWrapper>! = nil swiftUIView = SwiftUIView( LodgingPlaybackWrapper(propertySearchCriteria: propertySearchCriteria, playbackUpdateNotificationSender: playbackUpdateNotificationSender, componentHandler: { [weak self] componentId in self?.componentReady(componentId) }), viewDidLayoutSubviewsCallback: { [weak self] in let extraPadding = self?.playbackViewExtraPadding ?? Spacing.spacing8x let newHeight = swiftUIView.frame.size.height + extraPadding // if newHeight != self?.sharedUIPlaybackViewHeightConstraint?.constant { // self?.sharedUIPlaybackViewHeightConstraint?.constant = 206.33 // }else { // self?.sharedUIPlaybackViewHeightConstraint?.constant = 80 // } } ).withAutoLayout().withAccessibilityIdentifier("test") // sharedUIPlaybackViewHeightConstraint = containerView.heightAnchor.constraint(equalToConstant: 0) // sharedUIPlaybackViewHeightConstraint?.isActive = true containerView.backgroundColor = .blue swiftUIView.backgroundColor = .red containerView.addSubview(swiftUIView) containerView.addConstraints([ swiftUIView.topAnchor.constraint(equalTo: containerView.topAnchor, constant: playbackViewTopConstant), swiftUIView.leadingAnchor.constraint(equalTo: containerView.leadingAnchor, constant: Spacing.spacing4x), swiftUIView.trailingAnchor.constraint(equalTo: containerView.trailingAnchor, constant: -Spacing.spacing4x), swiftUIView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor, constant: -Spacing.spacing3x), swiftUIView.heightAnchor.constraint(equalToConstant: 206.33) ]) return containerView }() old devs created this function viewDidLayoutSubviewsCallback to connect user interaction on the wrapper and used on UIKit. this is the part where the math on the function gets weird and messed up the code by crashing the view viewDidLayoutSubviewsCallback: { [weak self] in let extraPadding = self?.playbackViewExtraPadding ?? Spacing.spacing8x let newHeight = swiftUIView.frame.size.height + extraPadding if newHeight != self?.sharedUIPlaybackViewHeightConstraint?.constant { self?.sharedUIPlaybackViewHeightConstraint?.constant = newHeight } } ).withAutoLayout().withAccessibilityIdentifier("test") sharedUIPlaybackViewHeightConstraint = containerView.heightAnchor.constraint(equalToConstant: 0) sharedUIPlaybackViewHeightConstraint?.isActive = true I commented this math because is crashing the app and instead of giving a dynamical height I placed as a constant constraint as default height this is how I solved the problem of the UI, but I still need to update the view each time the user clicks and gets call by the method viewDidLayoutSubviewsCallback what can I do? I tried to add like a conditional on the method if newHeight == 80 { containerView.addConstraints([ swiftUIView.heightAnchor.constraint(equalToConstant: 80.0) ]) containerView.layoutIfNeeded() } else { containerView.addConstraints([ swiftUIView.heightAnchor.constraint(equalToConstant: 206.33) ]) containerView.layoutIfNeeded() } like this but it didn't work [this is how it looks with the constant value of 206.33] [when it gets open looks good]
2
0
300
Mar ’25
Best way to measure days between dates
Hey team I'm facing an issue where startDate is 1 January 2025 and endDate is 31 March 2025 between this 2 dates is 90 days, but on my code is being taken as 89 days I've seen the math of the code excludes the first partial day (from midnight to 06:00) on 2025-01-01, which results in 89 full days instead of 90 days. startDate: 2025-01-01 06:00:00 +0000 endDate: 2025-03-31 06:00:00 +0000 this is my function func daysBetweenDates() -> Int? { guard let selectedStartDate = selectedStartDate?.date else { return nil } guard let selectedEndDate = selectedEndDate?.date else { return 0 } let calendar = Calendar.current let dateComponents = calendar.dateComponents([.day], from: selectedStartDate, to: selectedEndDate) return dateComponents.day } what I've tried is reset the hours to 0 so it can take the full day and return 90 days like this func daysBetweenDates() -> Int? { guard let selectedStartDate = selectedStartDate?.date else { return nil } guard let selectedEndDate = selectedEndDate?.date else { return 0 } var calendar = Calendar(identifier: .gregorian) calendar.timeZone = TimeZone(secondsFromGMT: 0) ?? .current let cleanMidNightStartDate = calendar.startOfDay(for: selectedStartDate) let cleanMidNightEndDate = calendar.startOfDay(for: selectedEndDate.addingTimeInterval(24 * 60 * 60)) let dateComponents = calendar.dateComponents([.day], from: cleanMidNightStartDate, to: cleanMidNightEndDate) let daysCount = dateComponents.day ?? 0 return daysCount } this worked for that date specifically but when I tried to change the date for example startDate: 18 December 2024. endDate: 18 March 2025. between those dates we have 90 days but this function now reads 91. what I'm looking is a cleaver solution for this problem so I can have the best posible quality code, thanks in advance!
1
0
549
Dec ’24
Expandable UIView inside Navigation Bar can't be clicked/tapped
Hello Team we facing a problem with a UIView inside of a Navigation Bar what we need to achieve is to place a UIView (SwiftUI Wrapper) on the middle of the Navigation bar Here's how it looks like right now that's already complete, but now the problem that we are facing is that the View is not detecting the clicks/taps on the 'dates and 'travelers' here's the Code for the View private lazy var sharedUIPlaybackView: UIView = { let containerView = UIView().withAutoLayout() containerView.backgroundColor = .red containerView.styleBorder(color: .systemPink, width: 1) let propertySearchCriteria = PropertySearchCriteriaBuilder(hotelSearchParameters: viewModel.hotelSearchParameters).criteria var swiftUIView: SwiftUIView<LodgingPlaybackWrapper>! = nil swiftUIView = SwiftUIView( LodgingPlaybackWrapper(propertySearchCriteria: propertySearchCriteria, playbackUpdateNotificationSender: nil, componentHandler: { [weak self] componentId in self?.componentReady(componentId) }), viewDidLayoutSubviewsCallback: { [weak self] in let newHeight = swiftUIView.frame.size.height if newHeight != self?.sharedUIPlaybackViewHeightConstraint?.constant { self?.sharedUIPlaybackViewHeightConstraint?.constant = newHeight self?.additionalSafeAreaInsets.top = 200 } } ).withAutoLayout().withAccessibilityIdentifier("searchPlayback") sharedUIPlaybackViewHeightConstraint = containerView.heightAnchor.constraint(equalToConstant: 0) sharedUIPlaybackViewHeightConstraint?.isActive = true swiftUIView.backgroundColor = .blue swiftUIView.styleBorder(color: .orange, width: 1) containerView.addSubview(swiftUIView) containerView.addConstraints([ swiftUIView.leadingAnchor.constraint(equalTo: containerView.leadingAnchor, constant: Spacing.spacing4x), swiftUIView.trailingAnchor.constraint(equalTo: containerView.trailingAnchor, constant: -Spacing.spacing4x) ]) self.view.bringSubviewToFront(swiftUIView) swiftUIView.isUserInteractionEnabled = true swiftUIView.layer.zPosition = 1 return containerView }() my first suspicion was that the this part of the code was not expanding correctly viewDidLayoutSubviewsCallback: { [weak self] in let newHeight = swiftUIView.frame.size.height if newHeight != self?.sharedUIPlaybackViewHeightConstraint?.constant { self?.sharedUIPlaybackViewHeightConstraint?.constant = newHeight self?.additionalSafeAreaInsets.top = 200 } } but after I place border and background colors on the views was clear for me that it was expanding properly, so I added some modifiers for the view like swiftUIView.isUserInteractionEnabled = true swiftUIView.layer.zPosition = 1 but didn't work, I'm asking for a solution and different point of view for the code to be more cleaner and do the best implementation posible. This Navigation bar should be treated as a custom Navigation Bar, or it is good for us to expand and treat the Navigation bar like this? (expanding and adding a Custom View) thanks in advance to anyone who read this. here's the View Hierarchy
Topic: UI Frameworks SubTopic: SwiftUI Tags:
1
0
486
Jun ’24
Generates all possible subsets of a given set, excluding the empty set. (non sorted)
I notice that this operation is expensive for the code (2^set.size). I'm looking the best practices and implementations more likely a re-work this code goes to a infinite bucle and freezes the app until it's done func generateSubsets(set: Set<String>) -> Set<Set<String>> { if set.count == 1 { return [set] } let first = set.map { item -> Set<String> in var clone = set clone.remove(item) return clone } let second = first.map(generateSubsets) var subSets = second.reduce(Set<Set<String>>()) { accumulator, elements in var clone = accumulator for element in elements { clone.insert(element) } return clone } subSets.insert(set) return subSets } Example For input ["qual1", "qual2", 'qual3"] the combinations can be: ["qual1#qual2#qual3", "qual1#qual2", "qual1#qual3", "qual2#qual3", "qual1", "qual2", "qual3"]
4
0
807
Mar ’24
edit certain section in viewForFooterInSection
Hey guys I'm having some struggles when trying to understand how to edit certain section for a viewForFooterInSection note the edit occurs when the user types something and this function gets call, that is already managed override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { return prepareFooterView(tableView: tableView, section: section) } the question is how can I access certain section for me to edit the title on it? the function for footherview is: func prepareFooterView(tableView: UITableView, section: Int) -> UIView?{ guard let tableView = tableView as? LightTableView else { return UIView() } guard section <= TableSection.all.count else { return UIView() } ///the section is obtained here let section = TableSection.all[section] var title = "" switch section { case .detailsFooterView: title = "card_details_section_footer".localized case .nickname: if nickname?.isValidNickName == false { return prepareSpecificMessageInFooterView(with: "card_nickname_section_footer_error".localized, errorMessage: true) } title = "card_nickname_section_footer".localized case .fastlink: title = "earn_rewards_section_footer".localized default: title = "" } var footerView = tableView.standardFooterView(withTitle: title, textAlignment: .left, accessibilityIdentifier: section == .nickname || section == .fastlink || section == .detailsFooterView ? "NicknameFooterViewID" : nil, labelPadding: UIEdgeInsets(top: 12, left: 16, bottom: 0, right: -16)) return section == .nickname || section == .fastlink || section == .detailsFooterView ? footerView : nil } I would like to edit the case .fastlink: when a flag is turned ON the section here: num TableSection: Int { case details case detailsFooterView case nickname case fastlink case scan static var all: [TableSection] = isUs ? [.details, .detailsFooterView, .nickname, .fastlink] : [.details, .detailsFooterView, .nickname, .fastlink, .scan] } I guess this is not clear for me because this is running live instead of reloading the entire screen for example indexPath.row == 1
1
0
502
Jun ’22
Incremental compilation has been disabled: it is not compatible with whole module optimization on Release build configuration
Hey Developers I'm facing some strange situation, I'm getting multiples issues related to optimization on Release build configuration, I'm using Xcode 13.2.1 project is separated in 4 markets and multiples frameworks none of the markets have dependencies from each other, issue only appears when the market RefrreshAtPumpAUS Release is build, on the other side for Debug everything is functional and the app build fine. here's my Podfile: Podfile in order to add the : def adobe_manager_pods into the framework: CoolMasterUtilsFramework as the project is in 4 different markets had to added in the different markets like this:    target 'RefrreshAtPumpNL' do           # Pods for RefrreshAtPump     common_pods     adobe_manager_pods --> here       target 'RefrreshAtPumpUS' do        # Pods for RefrreshAtPump    common_pods    firebase_pods    adobe_campaign_pods    adobe_manager_pods. --> here       target 'RefrreshAtPumpUK' do             # Pods for RefrreshAtPump    common_pods    adobe_manager_pods --> here but for the AUS market(RefrreshAtPumpAUS) is quite different already had added similar PODS   target 'RefrreshAtPumpAUS' do        # Pods for RefrreshAtPump    common_pods    firebase_pods    adobe_experience_pods. ->> here they have this so, I added the 2 remaining that I needed for that specific market.   def adobe_experience_pods    pod 'AEPAudience', '~> 3.0’ ------->> THIS ONE    pod 'ACPUserProfile', '~> 2.2’ ------->> THIS ONE    pod 'AEPEdgeIdentity', '~> 1.0'    pod 'AEPEdgeConsent', '~> 1.0'    pod 'AEPCore', '~> 3.0'    pod 'AEPIdentity', '~> 3.0'    pod 'AEPSignal', '~>3.0'    pod 'AEPLifecycle', '~>3.0'    pod 'AEPUserProfile', '~> 3.0'    pod 'AEPEdge', '~> 1.0'    pod 'AEPMessaging', '~> 1.0'    pod 'AEPAssurance', '~> 3.0', :configurations => ['Debug']   end so if I run the project in all other markets as RELEASE or DEBUG everything goes well, but only for RELEASE on RefrreshAtPumpAUS shows errors like this:  multiple errors I've tried adding lines inside the RefrreshAtPumpAUS like this: 1.- post_install do |installer| 2.- Pod update 3.- delete all Derived data 4.- in Build settings -> Apple Clang - Code generation -> Optimization level to None[-O0] 5.- in Build settings -> Build active architecture only -> ALL to YES 6.- in podfile -> delete this line use_frameworks! and adding use_modular_headers!  7.- in Build settings -> Swift compiler -> Code generation -> Incremental to all Error 1
18
0
13k
May ’22
how to disable Zoom-Out & Zoom-In
Hi developers is there any chanse to disable Zoom-Out &amp; Zoom-In in WkWebView?here's all my code so far keep in mind i'm only displaying a web in webView i don't have any other functions 😕import UIKit import WebKit class ViewController: UIViewController, WKNavigationDelegate { @IBOutlet var webView: WKWebView! override func viewDidLoad() { super.viewDidLoad() displayWebPage() let preferences = WKPreferences() preferences.javaScriptEnabled = true let configuration = WKWebViewConfiguration() configuration.preferences = preferences let webView = WKWebView(frame: .zero, configuration: configuration) // Do any additional setup after loading the view, typically from a nib. } private func displayWebPage() { let url = URL(string: "hee hee") let request = URLRequest(url: url!) webView.navigationDelegate = self webView.load(request) webView.sizeToFit() } func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) { print(error) } }
9
1
21k
Nov ’21
UICollectionView Inside of UItableViewCell no horizontal scrolling
Hi, i'm having this issue using Xcode 12.2 were i can't scroll in horizontal direction a UICollectionView, i have try multiples answers from the forum and none of then work for me first of all what i'm only trying to achieve is the scroll horizontally. Heres my UITableView declaration on the View: }() here's the Delegate and DataSource protocols in VC: } This is the code for UICollectionView declaration on the NumberOfSeasonsCell or UITableViewCell }() Protocols for the UICollectionView } i've read that i should store the last position of the Table for scrolling the UICollectionView but i've tried but not work for me here's the UICollectionViewCell }
4
0
5.2k
Jul ’21
update UIKit view when viewDidLayoutSubviewsCallback from swiftUI wrapper gets call
Hello team i notice that we have a problem in our app that every time the user opens a Textfield the app freezes when the keyboard appears, this behavior was tracked down and it's a UI breaking design on a UIView [this view it's expandable and is original size is 80] [when it gets expanded 206.33] this is the view code I change the colors to easy check the other's views created inside private lazy var sharedUIPlaybackView: UIView = { let containerView = UIView().withAutoLayout() let propertySearchCriteria = PropertySearchCriteriaBuilder(hotelSearchParameters: viewModel.hotelSearchParameters).criteria var swiftUIView: SwiftUIView&lt;LodgingPlaybackWrapper&gt;! = nil swiftUIView = SwiftUIView( LodgingPlaybackWrapper(propertySearchCriteria: propertySearchCriteria, playbackUpdateNotificationSender: playbackUpdateNotificationSender, componentHandler: { [weak self] componentId in self?.componentReady(componentId) }), viewDidLayoutSubviewsCallback: { [weak self] in let extraPadding = self?.playbackViewExtraPadding ?? Spacing.spacing8x let newHeight = swiftUIView.frame.size.height + extraPadding // if newHeight != self?.sharedUIPlaybackViewHeightConstraint?.constant { // self?.sharedUIPlaybackViewHeightConstraint?.constant = 206.33 // }else { // self?.sharedUIPlaybackViewHeightConstraint?.constant = 80 // } } ).withAutoLayout().withAccessibilityIdentifier("test") // sharedUIPlaybackViewHeightConstraint = containerView.heightAnchor.constraint(equalToConstant: 0) // sharedUIPlaybackViewHeightConstraint?.isActive = true containerView.backgroundColor = .blue swiftUIView.backgroundColor = .red containerView.addSubview(swiftUIView) containerView.addConstraints([ swiftUIView.topAnchor.constraint(equalTo: containerView.topAnchor, constant: playbackViewTopConstant), swiftUIView.leadingAnchor.constraint(equalTo: containerView.leadingAnchor, constant: Spacing.spacing4x), swiftUIView.trailingAnchor.constraint(equalTo: containerView.trailingAnchor, constant: -Spacing.spacing4x), swiftUIView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor, constant: -Spacing.spacing3x), swiftUIView.heightAnchor.constraint(equalToConstant: 206.33) ]) return containerView }() old devs created this function viewDidLayoutSubviewsCallback to connect user interaction on the wrapper and used on UIKit. this is the part where the math on the function gets weird and messed up the code by crashing the view viewDidLayoutSubviewsCallback: { [weak self] in let extraPadding = self?.playbackViewExtraPadding ?? Spacing.spacing8x let newHeight = swiftUIView.frame.size.height + extraPadding if newHeight != self?.sharedUIPlaybackViewHeightConstraint?.constant { self?.sharedUIPlaybackViewHeightConstraint?.constant = newHeight } } ).withAutoLayout().withAccessibilityIdentifier("test") sharedUIPlaybackViewHeightConstraint = containerView.heightAnchor.constraint(equalToConstant: 0) sharedUIPlaybackViewHeightConstraint?.isActive = true I commented this math because is crashing the app and instead of giving a dynamical height I placed as a constant constraint as default height this is how I solved the problem of the UI, but I still need to update the view each time the user clicks and gets call by the method viewDidLayoutSubviewsCallback what can I do? I tried to add like a conditional on the method if newHeight == 80 { containerView.addConstraints([ swiftUIView.heightAnchor.constraint(equalToConstant: 80.0) ]) containerView.layoutIfNeeded() } else { containerView.addConstraints([ swiftUIView.heightAnchor.constraint(equalToConstant: 206.33) ]) containerView.layoutIfNeeded() } like this but it didn't work [this is how it looks with the constant value of 206.33] [when it gets open looks good]
Replies
2
Boosts
0
Views
300
Activity
Mar ’25
Best way to measure days between dates
Hey team I'm facing an issue where startDate is 1 January 2025 and endDate is 31 March 2025 between this 2 dates is 90 days, but on my code is being taken as 89 days I've seen the math of the code excludes the first partial day (from midnight to 06:00) on 2025-01-01, which results in 89 full days instead of 90 days. startDate: 2025-01-01 06:00:00 +0000 endDate: 2025-03-31 06:00:00 +0000 this is my function func daysBetweenDates() -> Int? { guard let selectedStartDate = selectedStartDate?.date else { return nil } guard let selectedEndDate = selectedEndDate?.date else { return 0 } let calendar = Calendar.current let dateComponents = calendar.dateComponents([.day], from: selectedStartDate, to: selectedEndDate) return dateComponents.day } what I've tried is reset the hours to 0 so it can take the full day and return 90 days like this func daysBetweenDates() -> Int? { guard let selectedStartDate = selectedStartDate?.date else { return nil } guard let selectedEndDate = selectedEndDate?.date else { return 0 } var calendar = Calendar(identifier: .gregorian) calendar.timeZone = TimeZone(secondsFromGMT: 0) ?? .current let cleanMidNightStartDate = calendar.startOfDay(for: selectedStartDate) let cleanMidNightEndDate = calendar.startOfDay(for: selectedEndDate.addingTimeInterval(24 * 60 * 60)) let dateComponents = calendar.dateComponents([.day], from: cleanMidNightStartDate, to: cleanMidNightEndDate) let daysCount = dateComponents.day ?? 0 return daysCount } this worked for that date specifically but when I tried to change the date for example startDate: 18 December 2024. endDate: 18 March 2025. between those dates we have 90 days but this function now reads 91. what I'm looking is a cleaver solution for this problem so I can have the best posible quality code, thanks in advance!
Replies
1
Boosts
0
Views
549
Activity
Dec ’24
Expandable UIView inside Navigation Bar can't be clicked/tapped
Hello Team we facing a problem with a UIView inside of a Navigation Bar what we need to achieve is to place a UIView (SwiftUI Wrapper) on the middle of the Navigation bar Here's how it looks like right now that's already complete, but now the problem that we are facing is that the View is not detecting the clicks/taps on the 'dates and 'travelers' here's the Code for the View private lazy var sharedUIPlaybackView: UIView = { let containerView = UIView().withAutoLayout() containerView.backgroundColor = .red containerView.styleBorder(color: .systemPink, width: 1) let propertySearchCriteria = PropertySearchCriteriaBuilder(hotelSearchParameters: viewModel.hotelSearchParameters).criteria var swiftUIView: SwiftUIView<LodgingPlaybackWrapper>! = nil swiftUIView = SwiftUIView( LodgingPlaybackWrapper(propertySearchCriteria: propertySearchCriteria, playbackUpdateNotificationSender: nil, componentHandler: { [weak self] componentId in self?.componentReady(componentId) }), viewDidLayoutSubviewsCallback: { [weak self] in let newHeight = swiftUIView.frame.size.height if newHeight != self?.sharedUIPlaybackViewHeightConstraint?.constant { self?.sharedUIPlaybackViewHeightConstraint?.constant = newHeight self?.additionalSafeAreaInsets.top = 200 } } ).withAutoLayout().withAccessibilityIdentifier("searchPlayback") sharedUIPlaybackViewHeightConstraint = containerView.heightAnchor.constraint(equalToConstant: 0) sharedUIPlaybackViewHeightConstraint?.isActive = true swiftUIView.backgroundColor = .blue swiftUIView.styleBorder(color: .orange, width: 1) containerView.addSubview(swiftUIView) containerView.addConstraints([ swiftUIView.leadingAnchor.constraint(equalTo: containerView.leadingAnchor, constant: Spacing.spacing4x), swiftUIView.trailingAnchor.constraint(equalTo: containerView.trailingAnchor, constant: -Spacing.spacing4x) ]) self.view.bringSubviewToFront(swiftUIView) swiftUIView.isUserInteractionEnabled = true swiftUIView.layer.zPosition = 1 return containerView }() my first suspicion was that the this part of the code was not expanding correctly viewDidLayoutSubviewsCallback: { [weak self] in let newHeight = swiftUIView.frame.size.height if newHeight != self?.sharedUIPlaybackViewHeightConstraint?.constant { self?.sharedUIPlaybackViewHeightConstraint?.constant = newHeight self?.additionalSafeAreaInsets.top = 200 } } but after I place border and background colors on the views was clear for me that it was expanding properly, so I added some modifiers for the view like swiftUIView.isUserInteractionEnabled = true swiftUIView.layer.zPosition = 1 but didn't work, I'm asking for a solution and different point of view for the code to be more cleaner and do the best implementation posible. This Navigation bar should be treated as a custom Navigation Bar, or it is good for us to expand and treat the Navigation bar like this? (expanding and adding a Custom View) thanks in advance to anyone who read this. here's the View Hierarchy
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
1
Boosts
0
Views
486
Activity
Jun ’24
Generates all possible subsets of a given set, excluding the empty set. (non sorted)
I notice that this operation is expensive for the code (2^set.size). I'm looking the best practices and implementations more likely a re-work this code goes to a infinite bucle and freezes the app until it's done func generateSubsets(set: Set<String>) -> Set<Set<String>> { if set.count == 1 { return [set] } let first = set.map { item -> Set<String> in var clone = set clone.remove(item) return clone } let second = first.map(generateSubsets) var subSets = second.reduce(Set<Set<String>>()) { accumulator, elements in var clone = accumulator for element in elements { clone.insert(element) } return clone } subSets.insert(set) return subSets } Example For input ["qual1", "qual2", 'qual3"] the combinations can be: ["qual1#qual2#qual3", "qual1#qual2", "qual1#qual3", "qual2#qual3", "qual1", "qual2", "qual3"]
Replies
4
Boosts
0
Views
807
Activity
Mar ’24
edit certain section in viewForFooterInSection
Hey guys I'm having some struggles when trying to understand how to edit certain section for a viewForFooterInSection note the edit occurs when the user types something and this function gets call, that is already managed override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { return prepareFooterView(tableView: tableView, section: section) } the question is how can I access certain section for me to edit the title on it? the function for footherview is: func prepareFooterView(tableView: UITableView, section: Int) -> UIView?{ guard let tableView = tableView as? LightTableView else { return UIView() } guard section <= TableSection.all.count else { return UIView() } ///the section is obtained here let section = TableSection.all[section] var title = "" switch section { case .detailsFooterView: title = "card_details_section_footer".localized case .nickname: if nickname?.isValidNickName == false { return prepareSpecificMessageInFooterView(with: "card_nickname_section_footer_error".localized, errorMessage: true) } title = "card_nickname_section_footer".localized case .fastlink: title = "earn_rewards_section_footer".localized default: title = "" } var footerView = tableView.standardFooterView(withTitle: title, textAlignment: .left, accessibilityIdentifier: section == .nickname || section == .fastlink || section == .detailsFooterView ? "NicknameFooterViewID" : nil, labelPadding: UIEdgeInsets(top: 12, left: 16, bottom: 0, right: -16)) return section == .nickname || section == .fastlink || section == .detailsFooterView ? footerView : nil } I would like to edit the case .fastlink: when a flag is turned ON the section here: num TableSection: Int { case details case detailsFooterView case nickname case fastlink case scan static var all: [TableSection] = isUs ? [.details, .detailsFooterView, .nickname, .fastlink] : [.details, .detailsFooterView, .nickname, .fastlink, .scan] } I guess this is not clear for me because this is running live instead of reloading the entire screen for example indexPath.row == 1
Replies
1
Boosts
0
Views
502
Activity
Jun ’22
Incremental compilation has been disabled: it is not compatible with whole module optimization on Release build configuration
Hey Developers I'm facing some strange situation, I'm getting multiples issues related to optimization on Release build configuration, I'm using Xcode 13.2.1 project is separated in 4 markets and multiples frameworks none of the markets have dependencies from each other, issue only appears when the market RefrreshAtPumpAUS Release is build, on the other side for Debug everything is functional and the app build fine. here's my Podfile: Podfile in order to add the : def adobe_manager_pods into the framework: CoolMasterUtilsFramework as the project is in 4 different markets had to added in the different markets like this:    target 'RefrreshAtPumpNL' do           # Pods for RefrreshAtPump     common_pods     adobe_manager_pods --> here       target 'RefrreshAtPumpUS' do        # Pods for RefrreshAtPump    common_pods    firebase_pods    adobe_campaign_pods    adobe_manager_pods. --> here       target 'RefrreshAtPumpUK' do             # Pods for RefrreshAtPump    common_pods    adobe_manager_pods --> here but for the AUS market(RefrreshAtPumpAUS) is quite different already had added similar PODS   target 'RefrreshAtPumpAUS' do        # Pods for RefrreshAtPump    common_pods    firebase_pods    adobe_experience_pods. ->> here they have this so, I added the 2 remaining that I needed for that specific market.   def adobe_experience_pods    pod 'AEPAudience', '~> 3.0’ ------->> THIS ONE    pod 'ACPUserProfile', '~> 2.2’ ------->> THIS ONE    pod 'AEPEdgeIdentity', '~> 1.0'    pod 'AEPEdgeConsent', '~> 1.0'    pod 'AEPCore', '~> 3.0'    pod 'AEPIdentity', '~> 3.0'    pod 'AEPSignal', '~>3.0'    pod 'AEPLifecycle', '~>3.0'    pod 'AEPUserProfile', '~> 3.0'    pod 'AEPEdge', '~> 1.0'    pod 'AEPMessaging', '~> 1.0'    pod 'AEPAssurance', '~> 3.0', :configurations => ['Debug']   end so if I run the project in all other markets as RELEASE or DEBUG everything goes well, but only for RELEASE on RefrreshAtPumpAUS shows errors like this:  multiple errors I've tried adding lines inside the RefrreshAtPumpAUS like this: 1.- post_install do |installer| 2.- Pod update 3.- delete all Derived data 4.- in Build settings -> Apple Clang - Code generation -> Optimization level to None[-O0] 5.- in Build settings -> Build active architecture only -> ALL to YES 6.- in podfile -> delete this line use_frameworks! and adding use_modular_headers!  7.- in Build settings -> Swift compiler -> Code generation -> Incremental to all Error 1
Replies
18
Boosts
0
Views
13k
Activity
May ’22
how to disable Zoom-Out & Zoom-In
Hi developers is there any chanse to disable Zoom-Out &amp; Zoom-In in WkWebView?here's all my code so far keep in mind i'm only displaying a web in webView i don't have any other functions 😕import UIKit import WebKit class ViewController: UIViewController, WKNavigationDelegate { @IBOutlet var webView: WKWebView! override func viewDidLoad() { super.viewDidLoad() displayWebPage() let preferences = WKPreferences() preferences.javaScriptEnabled = true let configuration = WKWebViewConfiguration() configuration.preferences = preferences let webView = WKWebView(frame: .zero, configuration: configuration) // Do any additional setup after loading the view, typically from a nib. } private func displayWebPage() { let url = URL(string: "hee hee") let request = URLRequest(url: url!) webView.navigationDelegate = self webView.load(request) webView.sizeToFit() } func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) { print(error) } }
Replies
9
Boosts
1
Views
21k
Activity
Nov ’21
UICollectionView Inside of UItableViewCell no horizontal scrolling
Hi, i'm having this issue using Xcode 12.2 were i can't scroll in horizontal direction a UICollectionView, i have try multiples answers from the forum and none of then work for me first of all what i'm only trying to achieve is the scroll horizontally. Heres my UITableView declaration on the View: }() here's the Delegate and DataSource protocols in VC: } This is the code for UICollectionView declaration on the NumberOfSeasonsCell or UITableViewCell }() Protocols for the UICollectionView } i've read that i should store the last position of the Table for scrolling the UICollectionView but i've tried but not work for me here's the UICollectionViewCell }
Replies
4
Boosts
0
Views
5.2k
Activity
Jul ’21