Skip to content

develop to main#5

Open
Adletski wants to merge 14 commits intomainfrom
develop
Open

develop to main#5
Adletski wants to merge 14 commits intomainfrom
develop

Conversation

@Adletski
Copy link
Owner

finished all tasks, ready to merge from develop to main branch

@@ -0,0 +1,21 @@
{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше сделай картинку single scale, и в swift лучше загружать картинки в pdf формате

// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }

guard let windowScene = (scene as? UIWindowScene) else { return }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @Adletski


class ViewController: UIViewController {

private lazy var viewBackgroundImage: UIImageView = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

добавь пожалуйста // MARK: UI

imageView.frame = CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height)
return imageView
}()
private lazy var loginLabel: UILabel = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

пробел после блока

loginLabel.font = UIFont(name: "Futura", size: CGFloat(30))
return loginLabel
}()
private lazy var usernameTextField: UITextField = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

пробел после блока

usernameTextField.layer.cornerRadius = view.frame.width*0.063613
return usernameTextField
}()
private lazy var passwordTextField: UITextField = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

пробел после каждого блока

loginButton.layer.rasterizationScale = UIScreen.main.scale
loginButton.backgroundColor = .purple
loginButton.setTitleColor(.white, for: .normal)
loginButton.layer.cornerRadius = view.frame.width*0.063613
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

если хочешь сделать закругленные края, достачтоно view.frame.heigth/2
0.063613 магические числа лучше не используй, или сделай enum или struct с константой

loginButton.layer.cornerRadius = view.frame.width*0.063613
return loginButton
}()
private lazy var forgotPasswordButton: UIButton = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

пробел после блока

return loginButton
}()
private lazy var forgotPasswordButton: UIButton = {
let forgotPasswordButton = UIButton()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cntrl+I правки по код стайлу

return view2
}()
private lazy var facebookButton: UIButton = {
let facebookButton = UIButton()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше все кнопки создавать через UIButton(type: .system)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

будет эффект батута

return twitterButton
}()
private lazy var facebookView: UIImageView = {
let facebookView = UIImageView(frame: CGRect(x: 10, y: 5, width: 20, height: 20))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

фреймы это хорошо, но лучше все делать через snapkit

return facebookView
}()
private lazy var twitterView: UIImageView = {
let twitterView = UIImageView(frame: CGRect(x: 10, y: 5, width: 20, height: 20))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

фреймы это хорошо, но лучше все делать через snapkit

super.viewDidLoad()
// Do any additional setup after loading the view.

setupHierarchy()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setupHierarchy -> setupViews()

// Do any additional setup after loading the view.

setupHierarchy()
setupLayout()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setupLayout -> setupConstratints

let subviews = [viewBackgroundImage,loginLabel,usernameTextField,passwordTextField,loginButton,
forgotPasswordButton,view1,connectLabel,view2,facebookButton,facebookView,
twitterButton,twitterView,noAccount,signupButton]
subviews.forEach { view.addSubview($0) }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

круто сделал, офигенно


loginLabel.snp.makeConstraints { loginLabel in
loginLabel.centerX.equalTo(view)
loginLabel.top.equalTo(view).offset(view.frame.height*0.117)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

магическая математика плохая практика при верстке с кодом, подумай как бы ты сделал по другому


}

extension UITextField {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extension сделай лучше отдельный файлом, можешь сделать папки Foundation+Extension и UIKit+Extensions

forgotPasswordButton.centerX.equalTo(view)
forgotPasswordButton.top.equalTo(loginButton.snp.bottom).offset(view.frame.height*0.006)
}
view1.snp.makeConstraints { view1 in
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

view1 -> нужно переименовать, плохой нейминг

connectLabel.centerX.equalTo(view)
connectLabel.bottom.equalTo(view).inset(view.frame.height*0.235)
}
view2.snp.makeConstraints { view2 in
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

view2-> нужно переименовать, плохой нейминг

print(view.frame.height)
}
facebookButton.snp.makeConstraints { facebookButton in
facebookButton.centerX.equalTo(view).offset(-view.frame.width/2*0.407)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше сделать без математики, подумай как убрать ratio везде

twitterButton,twitterView,noAccount,signupButton]
subviews.forEach { view.addSubview($0) }
}
private func setupLayout() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// MARK: - Setup Constraints

setupHierarchy()
setupLayout()
}
private func setupHierarchy() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// MARK: - SetupViews

return signupButton
}()

override func viewDidLoad() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// MARK: - Lifecycle

twitterButton.layer.shadowOffset = .zero
twitterButton.layer.shadowRadius = 10
twitterButton.layer.shouldRasterize = true
twitterButton.layer.rasterizationScale = UIScreen.main.scale
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а что делает это свойство rasterizationScale?

connectLabel.font = .systemFont(ofSize: 15)
return connectLabel
}()
private lazy var view2: UIView = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нужно переименовать, назови лучше container

@aitemr
Copy link

aitemr commented Mar 1, 2023

Салем!

ДЗ принято

  1. Убрать везде магические числа, сделай лучше через явные отсупы
  2. Исправить по стайлгайду
  3. Добавить // MARK
  4. Добавить пробелы после блоков
  5. переименовать свойства
  6. вынести extension

view2.height.equalTo(1)
view2.width.equalTo(view.frame.width*0.178)
view2.bottom.equalTo(view).inset(view.frame.height*0.242)
print(view.frame.width)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нужно убрать принты

connectLabel.bottom.equalTo(view).inset(view.frame.height*0.235)
}
view2.snp.makeConstraints { view2 in
view2.centerX.equalTo(view).offset(-view.frame.width/2*0.509)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше сделать константы view.frame.width и view.frame.height

let width = view.frame.width
а потом везде его использовать

@aitemr
Copy link

aitemr commented Mar 1, 2023

Screen Shot 2023-03-01 at 10 39 07

@aitemr
Copy link

aitemr commented Mar 1, 2023

дз сделано отлично

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants