Post

Replies

Boosts

Views

Activity

Reply to How to declare a scope in code ?
There is not other method to declare the scope beside creating a new SwiftUI view file ? Your wording is confusing. You do not declare a scope, you declare something and depending where and how, that defines its visibility scope. Problem you had here was that the declaration was just missing, hence AdvancedSettingsView could not be found in the scope where you tried to use. Note that you can limit scope of visibility, with attributes as private, fileprivate.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’21
Reply to Cancel button not working?
In the storyboard, select the button for which you want to remove the action. Open the connection inspector on the right panel of Inspectors (last icon on the right in shape of a dot in a circle. You will find either an action or a sent event defined. Click on the small x to remove the connection. Do an option clean build folder to get fully rid of it.
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to Swift - AVPlayer - Stop player in another cell when a new player starts
You should show code, that would be much easier to explain.  I want other players You want a single player to play at any time ? So, you should have a reference to the activePlayer declared at the class level. It is nil to begin with. When you Play, you should first stop the activePlayer (after testing it is not nil) Then dismiss and set to nil Then create a new player instance and set it to activePlayer. If you have a stop func, do the same: stop the active player, dismiss it and set to nil. Could you better explain your Extra question ?
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to Swift - AVPlayer - Stop player in another cell when a new player starts
You didn't tell it was a collectionView. So change with: if let collectionView = cell.superview as? UICollectionView { let visibleCells = collectionView.visibleCells for cell in visibleCells where cell is CollectionViewCell { // The type of your cells // now you can access to properties if cell.player != nil { // I suppose you named the podPlayer as player // stop it playing // dismiss // set to nil } } }
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to How to declare a scope in code ?
"I want to program a function and I receive a 'scope' error". How do I declare a scope Just declare the property (which has the scope problem), in another place, for instance at the class level, not inside a func. If so, take care not to redeclare a property with the same name in the func. "I want to program a function and I receive a 'scope' error". Please also show the func and where you get the error message. To define AdvancedSettingsView, just do like any other SwiftUI View struct AdvancedSettingsView: View { var body: some View { Text("Hello") } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’21
Reply to UIPickerView button not worked
Why do you draw with animation ? What do you expect from it ? override func draw(_ rect: CGRect) { self.alpha = 0.0 UIView.animate(withDuration: 0.2, animations: { self.alpha = 1.0 }, completion: {_ in }) } Try removing this animation which may be conflicting with other animations.
Topic: UI Frameworks SubTopic: UIKit Tags:
May ’21