ips_mobile's People
ips_mobile's Issues
Замечания по EquationSolver
Замечания, по сути, больше эстетического характера. Но лучше привыкать пилить все красиво :)
- В методе
solve
классаsolver
локальные переменные начинаются с большой буквы. По CodeConvertion должны с маленькой. Странно смотрится наименование переменной P. Лучше давать читаемые и "схватываемые" на лету имена для переменных.
let P = 5
let Zero = Double(0).precised(P)
- Формат комментариев разный. Где-то сверху, где-то сбоку
// b * x + c = 0
if abs(b).precised(P) > Zero {
return Roots.root(x: -c / b)
}
if abs(c).precised(P) > Zero { // 0 * x + c = 0
return Roots.noRealRoots
}
return Roots.infiniteNumberOfRoots // 0 * x = 0
- NumberFormatter можно проинициализировать лениво.
https://mikebuss.com/2014/06/22/lazy-initialization-swift/
init() {
numberFormatter = NumberFormatter()
numberFormatter.numberStyle = .decimal
}
-
Расширения следует поместить в отдельный фильтр. А наименование
Toast
вообще не отражает суть того, что файл содержит расширение UIView и еще ряд классов/енумов -
Неиспользуемые методы лучше удалять, т.к. это захламляет проект
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
- extension-ы внутри файлов с классами лучше помечать марками по типу
//MARK: - Extension Name
Это помогает проще ориентироваться в структуре.
- Класс
Solver
можно сделать статическим
class Solver
- Вероятно, это можно убрать :)
// typedef boost::variant<NoRealRoots, InfiniteNumberOfRoots, double, std::pair<double, double>> EquationRoots;
Замечания по лабораторной работе "Drawing"
- Следует выпилить неиспользуемые фрагменты кода
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
- Для подобный extension-ов лучше создавать отдельный фильтр
- Лишний импорт
UIKit
import UIKit
import UIKit.UIBezierPath
- Поля можно сделать с публичными геттерами и приватными сеттерами
private(set) var ...
var diameter: Double = 1 {
didSet(oldValue) {
if oldValue != diameter {
view?.setPointSize(diameter: diameter)
}
}
}
var color: Color = 0 {
didSet(oldValue) {
if oldValue != color {
view?.setPointColor(color: color)
}
}
}
- В таких случаях лучше править форматирование переносами строк
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator)
like
override func viewWillTransition(to size: CGSize,
with coordinator: UIViewControllerTransitionCoordinator)
Замечания по лабораторной работе "Navigation"
- Зачем пустое расширение для UIPageViewControllerDelegate?
extension PagesViewController: UIPageViewControllerDelegate {}
- Странное наименование переменной
var output: ChangePageColorCallback?
-
В файле ImageViewController.swift 3 разных класса. Следует растащить их по разным файлам.
-
Лучше ликвидировать неиспользуемые методы
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
Thread.sleep(forTimeInterval: 3.0)
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
- Лишние переносы строк и неиспользуемый перегруженный метод
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
}
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.