Swift: Lets Build YouTube - Home Feed: UICollectionView, AutoLayout (Ep 1)

Lets Build That App · 247K views · 2016 · 38:51

Open on YouTube

Software (other)UX & UI designtutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as a reference for programmatic iOS layout, such as visual-format constraint helpers, custom collection-view menus, and reusable view code.

Recommended by 1 people across 1 different months, 2016 to 2019.

What it is

The first episode of a Swift tutorial series on rebuilding the YouTube iOS app, presented by the Lets Build That App channel. It builds the Home Feed screen using UICollectionView and AutoLayout, written programmatically without storyboards.

What people said

Recommends Mark · 2018-08 · Stack Overflow · on “Tabbar Controller with swipe effect”

If anyone is still looking you can find another implementation here on this youtube series [this video] Edit: So to my knowledge and according to the video, the idea is that you'll want to use two UICollectionViews in one view controller. One collection view to display the content (apps) and the other for the horizontal navigation containing the categories. To create the green 'highlight' bar you can use a UIView and adjust the height/width of the bar using constraints - heightAnchor/widthAnchor and add that to the navigation bar. To get the bar moving with the distance the user will swipe, there is a method you can override to capture the horizontal scrolling called scrollViewDidScroll . From he

Cites user6248853 · 2016-07 · Stack Overflow · on “Programmatically create constraints for UIButton”

You can add this extension at the end of your class extension UIView { func addCosntraintsWithFormat(format: String, views: UIView...) { var viewsDictionary = [String: UIView]() for (index, view) in views.enumerate() { let key = "v\(index)" viewsDictionary[key] = view } addConstraints(NSLayoutConstraint.constraintsWithVisualFormat(format, options: NSLayoutFormatOptions(), metrics: nil, views: viewsDictionary)) } } and then you can add constraints like this self.scrollView.addConstraintsWithFormat("H:[v0(\(YourWidthConstant))]|", views: shareButton) self.scrollView.addConstraintsWithFormat("V:|[v0(\(YourHeightConstant))]", views: shareButton) And the source of this information is this [this video]

Cites jlmurph · 2017-07 · Stack Overflow · on “Creating multiple buttons in a line for an action sheet in Swift”

Unfortunately you need to build the controller from scratch. While it might seem daunting, the hardest part is the presentation logic. afterwards it's just a matter of subclassing this main class per-ui use case and giving each of those subclasses their own logics on build. Here's your best approach for custom AlertControllers: [LINK] You use a main class like the one in this gist file here, pay attention to the comments for each part. Then when you subclass each type //An example subclass of PopUpAlertController class SpecificAlertControllerSubclass : PopUpAlertController { override func set() { super.set() //Good idea to call the super., since you might want to add basic stuff all the time

Cites Frankenstein · 2017-08 · Stack Overflow · on “Side menu controller”

You could create a custom class that does all the tableview initialization as a BaseClass and make childClass for different Menus. Instead of: class menu1: UITableViewController { } class menu2: UITableViewController { } Use this: class BaseTableViewController: UITableViewController { } class menu1: BaseTableViewController { } class menu2: BaseTableViewController { } Reuse the class and make a fetch function content for cell with customizable input parameters. You could refer letsbuildthatapp youtube tutorial series for reference. It has a letsbuildyoutube [this video] app series.

Cites iAj · 2019-04 · Stack Overflow · on “Derived Safe Class from NSObject class for JSON parsing in iOS Swift”

// // MARK:- SafeJsonObject // @objcMembers class SafeJsonObject: NSObject { override func setValue(_ value: Any?, forKey key: String) { let uppercasedFirstCharacter = String(key.first!).uppercased() let range = NSMakeRange(0, 1) let selectorString = NSString(string: key).replacingCharacters(in: range, with: uppercasedFirstCharacter) let selector = NSSelectorFromString("set\(selectorString):") let responds = self.responds(to: selector) if !responds { print("\n\n\n*******--->\(selector) key is missing in API response...<---*******\n\n\n") return } super.setValue(value, forKey: key) } } PC & reference: [this video]

Cites frazman · 2019-10 · Stack Overflow · on “Running ios simulator shows black screen”

I am a newbie trying to learn ios programming. So, I have Xcode 11.1 I deleted the main story board. My AppDelegate func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. window = UIWindow(frame: UIScreen.main.bounds) window?.makeKeyAndVisible() window?.rootViewController = ViewController() //UINavigationController(rootViewController: ViewController()) return true } My ViewController class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .white } } I removed the references of main from p