Login
Discover
Waves
Communities
Raidstead
Write
Login
Signup
Topics
#
swift4
Explore topics
#swift4
Global
Trending
Hot
New
Payout
Muted
Promoted
#swift4
New
#swift4
Follow to get notified about new posts with this tag
Get #swift4 by email
Follow
gunw
swift4
8y
[Grammer] 26 - Custom Operators
Custom Operators : prefix, postfix, infix 중 하나를 커스텀 infix operator + : MultiplicationPrecedence // 우선순위 그룹 설정 extension Int { static func +(left: Int, right: Int) -> Int { return (left * right) + (left
$ 0.000
0
1
gunw
swift4
8y
[Grammer] 25 - Operator Methods
Operator Methods static func operator(parameters) -> ReturnType { Code } struct Position { var x : Double var y : Double } extension Position { static func ==(left: Position, right: Positon) -> Bool {
$ 0.000
2
gunw
swift4
8y
[Grammer] 23 - Bitwise Operators, 24 - Identity Operator
Bitwise Operators 메모리에 저장된 실제 비트를 다룸. 연산 속도가 빠르고 코드가 짧음. 비트 연산은 정수만 가능함.(실수 x, 문자열x) &, |, ^, ~, <<, >> a : 0 0 1 0 0 0 1 1 b : 0 0 0 1 1 0 1 0 & : 0 0 0 0 0 0 1 0 (AND) : 0 0 1 1 1 0 1 1 (OR)
gunw
swift4
8y
[Grammer]21 - Ternary Coditional Operator, 22 - Range Operators
Ternary Coditional Operator : //condition ? expr1 : expr2 let condition = false let result = condition ? "eat" : "sleep" Range Operators a...b : Closed Range Operator a..<b : Half-open
hive.vote
hive
10d
Promoted
[🚨 Important 🚨] Incoming reset and new version of hive.vote!
You have 30 days to migrate to the new version of hive.vote. After 30 days, the old website with all the auto votes configured, will be terminated. The migration is manual and you have to create the rules
gunw
swift4
8y
[Grammer] 19 - Short-circuit Evaluation, Side Effect, 20 - Assignment Operators
Short-circuit Evaluation(단락 평가) var a = 1 var b = 2 func updateLeft() -> Bool { a += 1 return false } func updateRight() -> Bool { b += 1 return true } if updateLeft() && updateRight() { } print(a)
gunw
swift4
8y
[Grammer] 16 - Overflow Operators, 17 - Comparison Operators, 18 - Logical Operators
Overflow Operatiors &+ : Overflow Addition Operator &- : Overflow Subtraction Operator &: Overflow Multiplication Operator let a: Int8 = Int8.max let result = a &+ 1 // -128 let b: Int8
gunw
swift4
8y
[Grammer] 13 - Data Types with Memory, 14 - Operator Basics, 15 - Arithmetic Operators
Data Types(자료형) : 메모리에 저장되는 데이터의 크기를 결정. Primitive Data Types : [Interger, Floating-point, Boolean, Character, String] Compound Data Types : [Structure, Enumeration, Class, Tuple] Memory : 0(off)과 1(on)을
gunw
swift4
8y
[Grammer] 11 - Type Inference, Type Safety, 12 - Type Conversion, Type Aliases
Type Inference: 타입을 값을 보고 추론함. let num = 123 Type Annotation : 타입을 직접 지정함 let num: Int = 123 Type Safety : 안정성을 위해 자료형을 엄격히 구분. 모든 타입간 호환 불가. Int+Double / Int8+Int 등 모두 에러. 이러한 계산은 형변환이 필요. Type Conversion
tonyz
Black And White
15h
Promoted
Details. Monomad Challenge.
As seen in Amsterdam, parts of a bridge.
gunw
swift4
8y
[Grammer] 09 - Boolean, 10 - Strings and Characters
Boolean: 참/거짓을 구분. Swift에서는 true, false 2가지만 소문자로 존재. if 조건문이나 while 반복문에 자주 사용 import UIKit let valid: true let invalid = false let hasName: Bool = true let isMember: Bool = false Strings : 문자열. "
gunw
swift4
8y
[Grammer] 07 - Naming Convention, 08 - Numbers
Naming Conventions(이름 정의 규칙) Camel Case : UpperCamelCase와 lowerCamelCase로 구분. UpperCamelCase : Class, Structure, Enumeration, Extension, Protocol lowerCamelCase: Variable, Constant, Function, Property,
gunw
swift4
8y
[Grammer] 06 - Scope
Scope (범위) : (전역 범위 / 지역 범위) 로 구분. 전역 범위 동일한 범위에 있는 변수와 상수에 접근할 수 있다. 동일한 범위 안에서는 이전에 선언되어있는 변수와 상수에만 접근할 수 있다. 지역 범위 지역 범위에서는 자신의 상위에서 선언된 변수와 상수에 접근할 수 있다. class 시작부분 바로 아래에는 선언 구역이라 변수, 상수에 접근할 수 없다.
gunw
swift4
8y
[Grammer] 05 - Variables and Constants
Variables(변수) : Keyword, Identifier, Type, Initial Value 등을 이용함. var variableName = initialValue var name = "James" var year = 2017 var swiftVersion = 4.0 var isMale = true Constants(상수) : 값을
edward777
Holos&Lotus
38m
Published via Ecency
Promoted
Orgulloso de ser TÍO EDWARD // Proud to be UNCLE EDWARD [ES/EN)
Hola comunidad de @holos-lotus. Mi novia (@lianny) se me adelantó con el tema de este post y prácticamente me hizo una invitación formal que no puedo pasar por alto, he sido lento al publicar o comentar
gunw
swift4
8y
[Grammer] 04 - First-class Citizen, Special Characters
First-class Citizen 상수와 변수에 저장할 수 있다. 파라미터로 전달할 수 있다. 함수에서 리턴할 수 있다. Special Characters : 프로그래밍에 사용되는 특수문자들 !, ~(Tilde), (Grave Accent), @(At Symbol), #(Sharp), $(Dollar Sign) %(persent Sign), ^(Caret),
gunw
swift4
8y
[Grammer] 03 - Compile, Link, Run
Compiler : Source Code 를 분석해 Binary Code 로 변환. 그 동작을 Compile이라 함 Link : Framwork 와 Libarary 를 연결하는 과정. Build : Compile + Link Run : Compile된 파일을 실행하는 과정.
gunw
swift4
8y
[Grammer] 02 - Literal, Identifier, Keyword
Literals: 의미가 변하지 않고 있는 그대로 사용하는 값. (ex. 숫자(1,2,3...)) integer, Floating-point, String, Boolean, nil Literals 등 다양한 리터럴이 있음. Identifiers(식별자): 구분을 위한 이름. 아래에서 x가 identifier. let x = 4 Keywords(예약어): 프로그래밍
gunw
swift4
8y
[Grammer] 01. Token, Expression, Statement
Token : Identifier, Kewords, Punctuations, Operators, Literals 연산자 등이 있음. 간단히 더 이상 쪼갤 수 없는 원자 라고 할 수 있음. Expression (표현식) : 산술 표현식, 논리 표현식 등이 있음. Statement(문장) : ';' 세미콜론이 필요없음.
lesmann
We Are Alive Tribe
7h
Published via Ecency
Promoted
An Alive and Thriving Thursday afternoon!
Happy #aliveandthriving Thursday afternoon / evening to you and thank you for your visit! Today during the mid-day I took a bike ride to the Park and while there a few photos that I would like to share
gunw
ios
8y
04.Todo (date / navi)
기본 스토리보드 구성 모델파일 작성 dateFormatter를 이용한 날짜 계산 segue를 이용한 화면 전환 셀 재사용 메소드
gunw
ios
8y
03.facebook view
페이스북처럼 테이블뷰를 스토리보드없이 생성하는 프로젝트 특이점은 각 값을 모두 Key.swift와 같이 파일을 생성하여 다 따로 만들어주는점. AppDelegate.swift에서 루트뷰컨트롤러를 설정해주는 화면 제일 중요한 셀 생성 메소드 나머지 데이터소스와 딜리게이트는 일반적인 테이블뷰 생성과 비슷하다.
gunw
ios
8y
02. StopWatch
특이점은 뷰컨트롤러안에, 뷰안에 레이블을 두었고, 아래쪽에 테이블뷰를 넣었다. StopWatch.swift 를 생성하여 NSObject를 받는 클래스를 생성 버튼 모양을 동그라미로 바꿔준다.(viewDidLoad에 작성, 모양을 1:1 aspect로 바꾸어야 원이됨.) 이후 딜리게이트 메소드도 구현한다. changeButton 메소드를 구현하여 버튼 동작을
gunw
swift4
8y
Project.01 TabBar / TableView / ScrollView
탭바 컨트롤을 위해 간단하게 뷰컨트롤러 2개에 임베딩을 시킨다. 이후 Product.swift 파일을 생성하여 아래와 같이 작성한다. ProductsTableViewController 테이블뷰컨트롤러를 생성한 후 Product 배열을 프로퍼티로 생성한다. 배열에 각 셀에 들어갈 내용을 작성 후 prepare메소드를 불러와서 세그로 다음 화면으로 연결한다. 각
Older →
Explore communities