Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

В AppDelegate добавлен вывод на консоль для тестирования коммита чере… #694

Open
wants to merge 12 commits into
base: project_sprint_3_start
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
504 changes: 498 additions & 6 deletions MovieQuiz.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion MovieQuiz/Helpers/UIColor+Extensions.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
import UIKit

extension UIColor { }
/*extension UIColor {
static var ypGreen: UIColor { UIColor(named: "YP Green") ?? UIColor.green }
static var ypRed: UIColor { UIColor(named: "YP Red") ?? UIColor.red }
static var ypBlack: UIColor { UIColor(named: "YP Black") ?? UIColor.black}
static var ypBackground: UIColor { UIColor(named: "YP Background") ?? UIColor.darkGray }
static var ypGray: UIColor { UIColor(named: "YP Gray") ?? UIColor.gray }
static var ypWhite: UIColor { UIColor(named: "YP White") ?? UIColor.white}
}
*/
15 changes: 15 additions & 0 deletions MovieQuiz/Models/AlertModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// AlertModel.swift
// MovieQuiz
//
// Created by Кирилл Марьясов on 20.02.2024.
//

import Foundation

struct AlertModel {
let title: String
let message: String
let buttonText: String
let completion: (() -> Void)?
}
25 changes: 25 additions & 0 deletions MovieQuiz/Models/MostPopularMovies.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// MostPopularMovies.swift
// MovieQuiz
//
// Created by Кирилл Марьясов on 03.03.2024.
//

import Foundation

struct MostPopularMovies: Codable {
let errorMessage: String
let items: [MostPopularMovie]
}

struct MostPopularMovie: Codable {
let title: String
let rating: String
let imageURL: URL

private enum CodingKeys: String, CodingKey {
case title = "fullTitle"
case rating = "imDbRating"
case imageURL = "image"
}
}
14 changes: 14 additions & 0 deletions MovieQuiz/Models/QuizQuestion.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// QuizQuestion.swift
// MovieQuiz
//
// Created by Кирилл Марьясов on 19.02.2024.
//

import Foundation

struct QuizQuestion {
let image: Data
let text: String
let correctAnswer: Bool
}
14 changes: 14 additions & 0 deletions MovieQuiz/Models/QuizResultsViewModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// QuizResultsViewModel.swift
// MovieQuiz
//
// Created by Кирилл Марьясов on 17.03.2024.
//

import Foundation

struct QuizResultsViewModel {
let title: String
let text: String
let buttonText: String
}
15 changes: 15 additions & 0 deletions MovieQuiz/Models/QuizStepViewModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// QuizStepViewModel.swift
// MovieQuiz
//
// Created by Кирилл Марьясов on 19.02.2024.
//

import Foundation
import UIKit

struct QuizStepViewModel {
let image: UIImage
let question: String
let questionNumber: String
}
26 changes: 26 additions & 0 deletions MovieQuiz/Presentation/AlertPresenter.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// AlertPresenter.swift
// MovieQuiz
//
// Created by ДЖООООН СИНААААА ТА ТА ДА ТААААМ on 20.02.2024.
//

import UIKit

class AlertPresenter {
weak var viewController: UIViewController?

init(viewController: UIViewController) {
self.viewController = viewController
}

func showAlert(with model: AlertModel) {
let alert = UIAlertController(title: model.title, message: model.message, preferredStyle: .alert)
let action = UIAlertAction(title: model.buttonText, style: .default) { _ in
model.completion?()
}
alert.addAction(action)
viewController?.present(alert, animated: true, completion: nil)
}
}

135 changes: 130 additions & 5 deletions MovieQuiz/Presentation/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina6_1" orientation="portrait" appearance="dark"/>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<customFonts key="customFonts">
<array key="YS Display-Bold.ttf">
<string>YSDisplay-Bold</string>
</array>
<array key="YS Display-Medium.ttf">
<string>YSDisplay-Medium</string>
</array>
</customFonts>
<scenes>
<!--Movie Quiz View Controller-->
<scene sceneID="tne-QT-ifu">
Expand All @@ -15,13 +24,129 @@
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="sz3-dM-RX0">
<rect key="frame" x="20" y="58" width="374" height="804"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lQL-Xj-hGe">
<rect key="frame" x="0.0" y="0.0" width="374" height="23.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Вопрос:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="72" translatesAutoresizingMaskIntoConstraints="NO" id="Gaz-CP-oQm" userLabel="Question Title Label">
<rect key="frame" x="0.0" y="0.0" width="338" height="23.5"/>
<fontDescription key="fontDescription" name="YSDisplay-Medium" family="YS Display" pointSize="20"/>
<color key="textColor" name="YP White"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="1/10" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ihc-Ol-Q1Y" userLabel="Index Label">
<rect key="frame" x="338" y="0.0" width="36" height="23.5"/>
<accessibility key="accessibilityConfiguration" identifier="Index"/>
<fontDescription key="fontDescription" name="YSDisplay-Medium" family="YS Display" pointSize="20"/>
<color key="textColor" name="YP White"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Ik0-oR-LCP" userLabel="Preview Image">
<rect key="frame" x="0.0" y="43.5" width="374" height="561"/>
<color key="backgroundColor" name="YP White"/>
<accessibility key="accessibilityConfiguration" identifier="Poster"/>
<constraints>
<constraint firstAttribute="width" secondItem="Ik0-oR-LCP" secondAttribute="height" multiplier="2:3" id="cDU-Y4-OHn"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="20"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Рейтинг этого фильма меньше, чем 5?" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oH7-3Y-V2R" userLabel="Question Label">
<rect key="frame" x="0.0" y="624.5" width="374" height="99.5"/>
<fontDescription key="fontDescription" name="YSDisplay-Bold" family="YS Display" pointSize="23"/>
<color key="textColor" name="YP White"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="Sjf-YD-uxH">
<rect key="frame" x="0.0" y="744" width="374" height="60"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cKE-EP-8IX" userLabel="No Button">
<rect key="frame" x="0.0" y="0.0" width="177" height="60"/>
<color key="backgroundColor" name="YP White"/>
<accessibility key="accessibilityConfiguration" identifier="No"/>
<constraints>
<constraint firstAttribute="height" constant="60" id="HTA-w9-oD0"/>
</constraints>
<fontDescription key="fontDescription" name="YSDisplay-Medium" family="YS Display" pointSize="20"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="Нет">
<color key="titleColor" name="YP Black"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="15"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="noButtonClicked:" destination="BYZ-38-t0r" eventType="touchUpInside" id="yeW-z5-Tqs"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="249" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="JMz-Iv-I19" userLabel="Yes Button">
<rect key="frame" x="197" y="0.0" width="177" height="60"/>
<color key="backgroundColor" name="YP White"/>
<accessibility key="accessibilityConfiguration" identifier="Yes"/>
<fontDescription key="fontDescription" name="YSDisplay-Medium" family="YS Display" pointSize="20"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="Да">
<color key="titleColor" name="YP Black"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="15"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="yesButtonClicked:" destination="BYZ-38-t0r" eventType="touchUpInside" id="hh7-Vu-fgP"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="60" id="INd-zs-dfI"/>
</constraints>
</stackView>
</subviews>
</stackView>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="P6q-ki-U0A">
<rect key="frame" x="197" y="438" width="20" height="20"/>
</activityIndicatorView>
</subviews>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="backgroundColor" name="YP Black"/>
<constraints>
<constraint firstItem="sz3-dM-RX0" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="20" id="ByN-FC-ZG8"/>
<constraint firstItem="sz3-dM-RX0" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="10" id="E0V-gn-aHf"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="sz3-dM-RX0" secondAttribute="bottom" id="LOK-pE-OE2"/>
<constraint firstItem="P6q-ki-U0A" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="icK-TD-5Ar"/>
<constraint firstItem="P6q-ki-U0A" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="mHY-3L-FGN"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="sz3-dM-RX0" secondAttribute="trailing" constant="20" id="ofv-PU-VnE"/>
</constraints>
</view>
<connections>
<outlet property="activityIndicator" destination="P6q-ki-U0A" id="pLE-ia-puy"/>
<outlet property="counterLabel" destination="Ihc-Ol-Q1Y" id="A5Y-lH-a1N"/>
<outlet property="imageView" destination="Ik0-oR-LCP" id="dG9-VJ-cUe"/>
<outlet property="textLabel" destination="oH7-3Y-V2R" id="bAz-A6-EiW"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-55.072463768115945" y="55.580357142857139"/>
<point key="canvasLocation" x="-56.521739130434788" y="54.910714285714285"/>
</scene>
</scenes>
<resources>
<namedColor name="YP Black">
<color red="0.10199999809265137" green="0.10599999874830246" blue="0.13300000131130219" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="YP White">
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
Loading