Apple在Xcode 5中引入了一个与项目相关的新文件类型:"xccheckout".
该文件位于".xcodeproj/project.xcworkspace/xcshareddata /"目录中,似乎它与项目的版本控制系统有关.
这里有一个示例文件:http://pastebin.com/5EP63iRa
我想在VCS下应该忽略这种类型的文件,但我不确定.
所以这里是问题:
在Swift中声明属性有三种方法:
var optStr: String?
var normStr: String = "normStr"
var exactStr: String!
Run Code Online (Sandbox Code Playgroud)
第一个是具有optional类型的属性,在我们的例子中可以包含nil或String的类型.第二个是始终包含String 的属性.它应该在init或声明中初始化.
但第三种方式呢?
var exactStr: String!
Run Code Online (Sandbox Code Playgroud)
我在操场上做了一些实验,事实证明,需要一个功能,type?可以采取两种type,type?和type!变量作为参数:
var optStr: String?
var normStr: String
var forcedStr: String!
func printStr(str: String?) {
println("str: \(str)")
}
printStr(optStr) //prints: "str: nil"
//printStr(normStr) //doesn't compile as not initialized
printStr(forcedStr) //prints: "str: nil"
optStr = "optStr"; normStr = "normStr"; forcedStr = "forcedStr"
printStr(optStr) //prints "str: optStr"
printStr(normStr) //prints "str: normStr"
printStr(forcedStr) //prints …Run Code Online (Sandbox Code Playgroud) 我有一个自定义UITableViewCel(没什么花哨的)在Xcode 6.0上完美运行.当我尝试使用Xcode 6.1编译它时,编译器显示以下错误:
A non-failable initializer cannot chain to failable initializer 'init(style:reuseIdentifier:)' written with 'init?'
这是单元格的代码:
class MainTableViewCell: UITableViewCell {
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.setup()
}
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.setup()
}
func setup() {<...>}
}
Run Code Online (Sandbox Code Playgroud)
作为解决方案,编译器提出Propagate the failure with 'init?':
override init?(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.setup()
}
Run Code Online (Sandbox Code Playgroud)
我有点困惑.是否可以详细说明什么是a (non)failable initialiser以及如何使用和覆盖?
我刚刚更新到每晚最新生锈:
> rustc --version
rustc 0.11.0-pre-nightly (05ca9f7 2014-06-24 22:06:48 +0000)
host: x86_64-apple-darwin
Run Code Online (Sandbox Code Playgroud)
在那之后,即使是琐碎的程序也无法编译,并出现以下错误:
> cat main.rs
fn main() {
print!("Hello world");
}%
> rustc main.rs
main.rs:1:1: 1:1 error: can't find crate for `std`
main.rs:1 // Playground
^
error: aborting due to previous error
Run Code Online (Sandbox Code Playgroud)
是在夜间使用编译器错误还是我没有掌握语言中的一些核心思想?
有没有办法List在 SwiftUI 中删除分隔符或调整分隔符插入?
在 UIKit 中可以通过
tableView.separatorStyle = .none
Run Code Online (Sandbox Code Playgroud)
和
tableview.separatorInset = UIEdgeInsets(top: 0, left: 18, bottom: 0, right: 18)
Run Code Online (Sandbox Code Playgroud)
相应的 SwiftUI 替代品是什么?
第120列的Intellij Idea中有一条垂直线.
有没有办法将它移动一些任意列(我更喜欢每行一百个符号)?
在iOS8中有一个新属性UIView:layoutMargin
要以编程方式设置视图的边距:
self.view.layoutMargins = UIEdgeInsetsMake(0, 0, 10, 10);
Run Code Online (Sandbox Code Playgroud)
是否可以在Interface Builder中设置边距?
经过多年现代IDE(Visual Studio,Xcode,JetBrain产品)的编码,我已经习惯了非常宝贵的Jump to definition功能.当您学习新语言的核心功能时,它对于系统库和框架尤为重要.
是否有任何方法可以为Rust提供与任何现代IDE或文本编辑器相同的功能?任何vim,sublime文本插件?
我正在开发一个将iBeacons用于室内导航的应用程序,我发现locationManager:rangingBeaconsDidFailForRegion:withError:调用该函数的速率不够高,所以我要从CoreBluetooth中添加RSSI数据centralManager:didDiscoverPeripheral:advertisementData:RSSI:.
我发现了一个奇怪的事实:当我使用CoreLocation监听iBeacon并记录外设ID时:
- (void)centralManager:(CBCentralManager *)central
didDiscoverPeripheral:(CBPeripheral *)peripheral
advertisementData:(NSDictionary *)advertisementData
RSSI:(NSNumber *)RSSI
{
NSLog(@"%@, RSSI: %@", peripheral, RSSI);
Run Code Online (Sandbox Code Playgroud)
在不同设备上报告每个信标具有不同的UUID:
A25804BD-D77A-5004-4C2C-301D996C7367 - my iPhone 5
843F4237-6059-9A5E-AA34-0BD92304BE1F - colleague's iPhone 5
77685805-C253-52BD-B787-8B95308834FB - other colleague's iPad mini
Run Code Online (Sandbox Code Playgroud)
我们的想法是将每个信标的UUID绑定到它的位置,因此这种行为非常具有功能性.
为什么物理上相同的信标(未关闭/打开)的UUID在不同设备上有所不同?这是预期的行为吗?如果是,我怎么能选择退出呢?