Post

Replies

Boosts

Views

Activity

Reply to Problem with layout - CollectionView
In such a case, I prefer creating a customCell and register its nib, but you could try to do it directly in the cell. But it seems you have created the custom cells ? Anyway, constraints setting will be similar. First step is to set the size of cell in CollectionView: In your case, width should be equal to the full collectionView Width as defined here: Then set constraint for the imageView in the cell: control drag from ImageView up to the CellView in the list, ans set leading, trailing, top, bottom (value for bottom: 60) Set the ImageView View aspect to Aspect fit Then place the Label and set its constraints relative to image view: leading, trailing (may be less than the full image), top define the Label font as Autoshrink (in Attributes inspector) with minimum size factor of 0.5 Procede in the same way for other objects in cell. Do this and tell what you get. Note: if that does not work, please post temporarily a mail address so that we can share files by mail.
Topic: UI Frameworks SubTopic: UIKit Tags:
Nov ’21
Reply to Problem with layout - CollectionView
It would be so much easier if you sent project by mail… . Ok, so I have added this in ViewController.swift: Yes, and this could be done in IB as well. To have the image fit into its area, set the ImageView View aspect to Aspect fit And set constraints for the ImageView relative to its container (cell). To create rounded corners, you will need to use layer. But that will be done later.
Topic: UI Frameworks SubTopic: UIKit Tags:
Nov ’21
Reply to Scroll two collection view at one time, bug IOS 15
I created a simple VC with 2 collectionViews, no constraint defined: Code of the VC is very basic: import UIKit class TestViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource { @IBOutlet weak var collection1: UICollectionView! // delegate and dataSOurce defined in IB @IBOutlet weak var collection2: UICollectionView! func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 20 } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let id = collectionView.tag == 1 ? "Standard1" : "Standard2" let cell = collectionView.dequeueReusableCell(withReuseIdentifier: id, for: indexPath) for v in cell.contentView.subviews { v.removeFromSuperview() } cell.backgroundColor = collectionView.tag == 1 ? .red : .systemYellow let label = UITextView(frame: CGRect(x: 5, y: 4, width: 30, height: 20)) label.text = String(indexPath .row) cell.contentView.addSubview(label) return cell } override func viewDidLoad() { super.viewDidLoad() collection1.tag = 1 collection2.tag = 2 } } I run in iOS 15.0 simulator with Xcode 13RC and at start I can scroll first collection without moving second. So, you have probably defined something else in your project that causes this behavior.
Topic: UI Frameworks SubTopic: UIKit Tags:
Nov ’21
Reply to Problem with layout - CollectionView
In such a case, I prefer creating a customCell and register its nib, but you could try to do it directly in the cell. But it seems you have created the custom cells ? Anyway, constraints setting will be similar. First step is to set the size of cell in CollectionView: In your case, width should be equal to the full collectionView Width as defined here: Then set constraint for the imageView in the cell: control drag from ImageView up to the CellView in the list, ans set leading, trailing, top, bottom (value for bottom: 60) Set the ImageView View aspect to Aspect fit Then place the Label and set its constraints relative to image view: leading, trailing (may be less than the full image), top define the Label font as Autoshrink (in Attributes inspector) with minimum size factor of 0.5 Procede in the same way for other objects in cell. Do this and tell what you get. Note: if that does not work, please post temporarily a mail address so that we can share files by mail.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to When I create a new project on Xcode, I don't see "Life Cycle" and Options
That's normal. Since Xcode 13, you cannot select UIKit App Delegate Lifecycle for SwiftUI. So, there is no lifecycle to choose anymore. For Storyboard, only choice is UIKit App Delegate For SwiftUI, only choice is SwiftUI App You select the interface (Storyboard or SwiftUI) and the lifecycle is determined.
Replies
Boosts
Views
Activity
Nov ’21
Reply to When I create a new project on Xcode, I don't see "Life Cycle" and Options
On Apple's SwiftUI Tutorials (https://developer.apple.com/tutorials/swiftui/creating-and-combining-views) Step 3, there is Life Cycle Option. I am confused when I don't see that options on my Xcode. Just because that was written using Xcode 12.x and you use Xcode 13. Here is what I get with Xcode 12.4:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Problem with layout - CollectionView
It would be so much easier if you sent project by mail… . Ok, so I have added this in ViewController.swift: Yes, and this could be done in IB as well. To have the image fit into its area, set the ImageView View aspect to Aspect fit And set constraints for the ImageView relative to its container (cell). To create rounded corners, you will need to use layer. But that will be done later.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Do child view controllers inherit the frame of their parents?
How do you transition from one controller to the next ? With a segue ? You can define in IB (or in code) the transition mode: Set it to full Cover, both for parent and child.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Xcode 13.1 (13A1030d) crashing
They refer to acronis.    Kernel Extensions in backtrace:      com.acronis.notifyframework(2.0.25)[E389CC63-EF95-3A53-BDC5-2C51DC53E21C]@0xffffff7fa3559000->0xffffff7fa357efff Is it yours or a third party framework ? If third party, contact them and ask.
Replies
Boosts
Views
Activity
Nov ’21
Reply to iOS 15 app stuck at LaunchScreen
Have you set the scene management and defined the Scene Manifest in info.plist ?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to What does this error mean: Type '() -> cannot conform to 'View'?
To give you a clear explanation we would need to see your code. But that means that instead of designing a view (as with Text("Hello"), you wrote a func. So please, show code where the error occurs.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to XCode Storyboard
Just close the project, close Xcode and reopen.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to What project should I create to obtain the URL ?
Is the website on your Mac or already on the web ?
Topic: Code Signing SubTopic: General Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Scroll two collection view at one time, bug IOS 15
Does it occur when you scroll collection 1 and when you scroll collection 2 at first time ? What are the constrains for each collectionView ?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Scroll two collection view at one time, bug IOS 15
I created a simple VC with 2 collectionViews, no constraint defined: Code of the VC is very basic: import UIKit class TestViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource { @IBOutlet weak var collection1: UICollectionView! // delegate and dataSOurce defined in IB @IBOutlet weak var collection2: UICollectionView! func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 20 } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let id = collectionView.tag == 1 ? "Standard1" : "Standard2" let cell = collectionView.dequeueReusableCell(withReuseIdentifier: id, for: indexPath) for v in cell.contentView.subviews { v.removeFromSuperview() } cell.backgroundColor = collectionView.tag == 1 ? .red : .systemYellow let label = UITextView(frame: CGRect(x: 5, y: 4, width: 30, height: 20)) label.text = String(indexPath .row) cell.contentView.addSubview(label) return cell } override func viewDidLoad() { super.viewDidLoad() collection1.tag = 1 collection2.tag = 2 } } I run in iOS 15.0 simulator with Xcode 13RC and at start I can scroll first collection without moving second. So, you have probably defined something else in your project that causes this behavior.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to [ITLib] Get a tree of artists / albums (Mac OS Swift app)
What about writing ($0.artist?.name) ?? "--"
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Swift Playgrounds 4
Only Apple knows and won't tell before they announce… Those who tell probably don't know. Which features are you expecting most ?
Replies
Boosts
Views
Activity
Nov ’21
Reply to [ITLib] Get a tree of artists / albums (Mac OS Swift app)
What is "--" ? Special code or can I type "" ? Just a pseudo name, to avoid an empty string. You may filter them out after. Did you try ? Does it solves the crash ?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’21