在windows上操练swift语言:类和结构体
条件所限,只能在WINDOWS上学习SWIFT的基本语法。
还有,有swift for windows 1.9帮忙,
看书没那么燥。。。。
struct Resolution {
var width = 0
var height = 0
}
class VideoMode {
var resolution = Resolution()
var interlaced = false
var frameRate = 0.0
var name: String?
}
let someResolution = Resolution(width: 640, height: 480)
let someVideoMode = VideoMode()
print("The width of someResolution is \(someResolution.width)")
someVideoMode.resolution.width = 1280
print("The width of someVedioMode is \(someVideoMode.resolution.width)")
let hd = Resolution(width: 1920, height: 1080)
var cinema = hd
cinema.width = 2048
print("cienma is now \(cinema.width) pixels wide")
print("hd is still \(hd.width) pixels width")
enum CompassPoint {
case North, South, East, West
}
var currentDirection = CompassPoint.West
let rememberedDirection = currentDirection
currentDirection = .East
if rememberedDirection == .West {
print("The remembered direction is still .West")
}
let tenEighty = VideoMode()
tenEighty.resolution = hd
tenEighty.interlaced = true
tenEighty.name = "1080i"
tenEighty.frameRate = 25.0
let alsoTenEighty = tenEighty
alsoTenEighty.frameRate = 30.0
print("The frameRate property of tenEighty is now \(tenEighty.frameRate)")

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
-
上一篇
python常用数据类型操作-时间日历
python常用数据类型操作-时间日历 time模块 1、 获取当前时间戳。 从0时区的1970年1月1日0时0分0秒, 到所给定日期时间的秒数,为浮点数。 import time print(time.time()) 1523587843.3224387 2、 获取时间元祖。 很多python时间函数将时间处理为9个数字的元组,如下图 time.localtime([seconds]),默认当前时间戳。 >>> import time >>> time.localtime() time.struct_time(tm_year=2018, tm_mon=4, tm_mday=13,tm_hour=10, tm_min=59, tm_sec=54, tm_wday=4, tm_yday=103, tm_isdst=0) 3、 获取格式化时间。 3.1秒 -> 可读 import time time.ctime([seconds]),可选的时间戳,默认当前时间戳 >>>import time >>>time.ct...
-
下一篇
深入理解SpringCloud之DiscoveryClient探究
当我们使用@DiscoveryClient注解的时候,会不会有如下疑问:它为什么会进行注册服务的操作,它不是应该用作服务发现的吗?下面我们就来深入的探究一下其源码。 一、Springframework的LifeCycle接口 要搞明白这个问题我们需要了解一下这个重要的接口: /* * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distrib...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- SpringBoot2整合MyBatis,连接MySql数据库做增删改查操作
- SpringBoot2全家桶,快速入门学习开发网站教程
- SpringBoot2整合Redis,开启缓存,提高访问速度
- Dcoker安装(在线仓库),最新的服务器搭配容器使用
- Springboot2将连接池hikari替换为druid,体验最强大的数据库连接池
- Docker快速安装Oracle11G,搭建oracle11g学习环境
- SpringBoot2初体验,简单认识spring boot2并且搭建基础工程
- Docker使用Oracle官方镜像安装(12C,18C,19C)
- MySQL数据库在高并发下的优化方案
- SpringBoot2配置默认Tomcat设置,开启更多高级功能