ios-calculator's Introduction
ios-calculator's People
ios-calculator's Issues
Review #1
- Кейсы в enum следует именовать с маленькой буквы (например, https://docs.swift.org/swift-book/LanguageGuide/Enumerations.html).
@IBAction func plusMinusButton(_ sender: UIButton)
- если ссылка на кнопку внутри метода не нужна, ее можно убрать при генерации IBAction (в настройке нижнее поле Sender меняется на None).
if (wasDividedByZero)
- условие на Swift пишем без скобок!- В enum Operation прописано rawValue (соответствующие строки). Следовательно, можно получать конкретный объект по строке с помощью конструктора (https://docs.swift.org/swift-book/LanguageGuide/Enumerations.html#ID149) и убрать вот это вот все:
switch sender.currentTitle! {
case "÷":
operation = Operation.Divide
case "x":
operation = Operation.Multiply
case "+":
operation = Operation.Summarize
case "-":
operation = Operation.Substract
case "%":
operation = Operation.Remaind
default:
operation = Operation.Nothing
}
- Подобный код:
func basicDropShadow(button: UIButton){
button.layer.shadowColor = #colorLiteral(red: 0.1764705926, green: 0.01176470611, blue: 0.5607843399, alpha: 1)
button.layer.shadowOffset = CGSize(width: 1.0, height: 2.0)
button.layer.shadowRadius = 2.0
button.layer.cornerRadius = 4.0
}
лучше убрать в extension для класса UIButton. Тогда он станет годным для повторного использования, то есть можно будет таскать из проекта в проект. Да и класс UIViewController к данному функционалу мало отношения имеет.
- Не забывай про сочетание ctrl + I для причесывания кода.
- На симуляторе (да и на устройстве) твои шрифты не отображаются, поскольку ты их не совсем корректно подключил. Нужно в структуре проекта создать не папку, а Group (желтая папка) и добавить файлы туда. Для каждого шрифта нужно проверить включение в Target (галочка справа).
- Проверь тени, у меня они не отобразились.
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.