Архитектурный шаблон "Мрак в моделях" на нескольких языках и платформах
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

26 lignes
576B

  1. import UIKit
  2. // MARK: - Протоколы
  3. protocol MainSectionGrid { }
  4. // MARK: - Реализация
  5. extension Main {
  6. enum SectionGrid {
  7. static func setupCore(_ core: Main.Core) {
  8. let side = 50
  9. let space = 20
  10. let gap = side + space
  11. // Расставляем кнопки в сетке 4x4.
  12. for btn in core.buttons {
  13. let id = btn.tag
  14. let row = Int(id / 4)
  15. btn.frame = CGRect(x: gap + (id - row * 4) * gap, y: gap + row * gap, width: side, height: side)
  16. btn.backgroundColor = .blue
  17. }
  18. }
  19. }
  20. }