반응형

분류 전체보기 54

Swift) 11_클래스

import Cocoa //Class // 구조체 타입을 정하는 것이다. class Sample { var sampleProperty: Int = 10 // 가변 Property let fixedSampleProperty: Int = 100 // 불편 Property static var typeProperty: Int = 1000 // 타입 Property func instanceMethod() { print("instance method") } //타입 메서드 // 재정의 불가 타입 메서드 - static static func typeMethod() { print("type method-static") } // 재정의 기능 타입 메서드 - class class func classmethod(){ pri..

Swift) 10_Struct

import Cocoa // 10_ Struct // 구조체 // 구조체는 Swift에서 Type을 정의한다. // kotlin은 Struct구조이다. // 2020. 구글스토어 70% 코틀린이다. // Property & Method struct Sample { var sampleProperty: Int = 10 // 가변 Property let fixedSampleProperty: Int = 100 // 불편 Property static var typeProperty: Int = 1000 // 타입 Property func instanceMethod() { print("instance method") } static func typeMethod(){ print("type method") } } // ..

Swift) 09_값타입과 참조타입

import Cocoa // 09_ 값타입과 참조타입 p.20 /* @ Class - 전통적인 OOP 관점에서의 클래스 - 단일 상속 - 메소드 - 프로퍼티 - 참조타입 @ @ Struct (스위프트는 Struct언어이다.) - 다양한 형태로 사용 가능 - 상속 불가 - 메소드 - 프로퍼티 - 값 타입 - 구조체의 사용 시기 - 연관된 값들을 모아서 하나의 데이터 타입으로 선언하고 싶을 때 - 다른 객체 또는 함수등으로 전달 될 때 - 참조가 아닌 복사를 원할 때 - 자신을 상속할 필요가 없거나 상속 받을 필요가 없을 때 @ Enum (열거형) - 상속 불가 - 메소드 - 프로퍼티 - 값 타입 - 유사한 종류의 여러 값을 유의미한 이름으로 한 곳에 모아 정리 @ Value와 Reference 차이 - V..

Swift) 08_옵셔널.Playground

import Cocoa // Optional // - 값이 있을 수도 있고, 없으 수도 있음 // - nil을 포함 할 수도 있고, 아닐 수 도 있다. var constantNum = 100 //constantNum = nil // let optionalConstant : Int! = nil // 가져올 때 ! 쓴다. let optionalConstant2: Int? = nil // 선언할 때 ? 쓴다. // Optaional 계산 1 var constantNum1: Int? = 100 print(constantNum1! + 10) // Nil 값에 더하기는 안된다. constantNum1 = nil //print(constantNum1! +1) // Nil값 switch로 확인 방법 // 데이터 있을 ..

Swift) 07_반복문.Playground

import Cocoa // ----------------------------------------------------------------------- // let names = ["Anna","Alex","Brian","Jack"] for name in names{ print("Hello, \(name)!") } for (index, text) in names.enumerated(){ print("The name at index \(index) is \(text)") } // 얼마만큼 증가하는가? 0 부터 60까지 5만큼 증가한다. let minutes = 60 let minuteInterval = 5 for tickMark in stride(from: 0, to: minutes, by: minu..

IOS) SQLite + CRUD (생성+읽기+갱신+삭제)+(Navigation + TableView+ViewController)

// // AddViewController.swift // SQLite // // Created by Mac on 2020/08/31. // Copyright © 2020 MyMac. All rights reserved. // import UIKit import SQLite3 // SQLite3는 기본적으로 안에 있다. // SQLite는 한글 처리가 잘 안되어 있지만 최근 좋아지고 있다 그러나 항상 영문을 기반으로 두고 봐야 한다. class AddViewController: UIViewController { @IBOutlet weak var txtName: UITextField! @IBOutlet weak var txtDept: UITextField! @IBOutlet weak var txtPhone..

IOS) Server(서버에서 앱으로 이미지 다운로드 방법 ) (버튼 + ImageView) + 아파치 톰캣 필요 ( 터미널로 starup.sh)

// // ViewController.swift // ServerImage_01 // // Created by Mac on 2020/09/02. // Copyright © 2020 MyMac. All rights reserved. // import UIKit class ViewController: UIViewController { @IBOutlet weak var imgDisplay: UIImageView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } // 버튼 클릭 했을 때 이미지가 들어온다. @IBAction func btnLoadImage(_ sender: UI..

카테고리 없음 2020.09.02

IOS) Scrapy + Kanna_04 (기능설명 scrapy 로 가져온 데이터 + 원하는 년도 영화 100 리스트 scrapy + 원하는 영화 링크 주소 연결)

// // TableViewController.swift // Kanna_04 // // Created by Mac on 2020/09/01. // Copyright © 2020 MyMac. All rights reserved. // /// ---------------------- 순서 1 ---------------- 밑으로 2번 3번 import UIKit class TableViewController: UITableViewController, CrawlModelProtocol { @IBOutlet var listView: UITableView! var feedItem: NSArray = NSArray() // 배열 var feedItemAddress: NSArray = NSArray() var ye..

반응형