当前位置:网站首页>Keep learning swift
Keep learning swift
2022-07-03 12:34:00 【iWillook】
//
// main.swift
// Ultimate
//
// Created by Mewlan Musajan on 3/6/21.
//
import Foundation
@propertyWrapper
struct TwelveOrLess {
private var number: Int
init() {
self.number = 0
}
var wrappedValue: Int {
get {
number
}
set {
number = min(newValue, 12)
}
}
}
struct SmallRectangle {
@TwelveOrLess var height: Int
@TwelveOrLess var width: Int
}
var rectangle = SmallRectangle()
print(rectangle.width)
rectangle.height = 10
print(rectangle.height)
rectangle.width = 24
print(rectangle.width)
边栏推荐
猜你喜欢

剑指Offer04. 二维数组中的查找【中等】

Togaf certification self-study classic v2.0

Sword finger offer05 Replace spaces

New features of ES6

Display time with message interval of more than 1 minute in wechat applet discussion area

TOGAF认证自学宝典V2.0

1-2 project technology selection and structure

T430 toss and install OS majave 10.14

Prompt unread messages and quantity before opening chat group

Flutter 退出登录二次确认怎么做才更优雅?
随机推荐
CNN MNIST handwriting recognition
剑指Offer05. 替换空格
Write a simple nodejs script
Sqoop1.4.4原生增量导入特性探秘
Apprendre à concevoir des entités logicielles réutilisables à partir de la classe, de l'API et du cadre
temp
[combinatorics] permutation and combination (example of permutation and combination)
145. Post order traversal of binary tree
Introduction to concurrent programming (II)
剑指Offer06. 从尾到头打印链表
Slf4j log facade
2021 autumn Information Security Experiment 1 (password and hiding technology)
雲計算未來 — 雲原生
Flutter: self study system
剑指Offer07. 重建二叉树
2.8 overview of ViewModel knowledge
Nodejs+Express+MySQL实现登陆功能(含验证码)
Sword finger offer09 Implementing queues with two stacks
剑指Offer03. 数组中重复的数字【简单】
Jsup crawls Baidu Encyclopedia