小编Art*_*mov的帖子

XCS中的*.xccheckout文件应该在VCS下被忽略吗?

Apple在Xcode 5中引入了一个与项目相关的新文件类型:"xccheckout".

该文件位于".xcodeproj/project.xcworkspace/xcshareddata /"目录中,似乎它与项目的版本控制系统有关.

这里有一个示例文件:http://pastebin.com/5EP63iRa

我想在VCS下应该忽略这种类型的文件,但我不确定.

所以这里是问题:

  1. 应该忽略"xccheckout"吗?
  2. 它的目的是什么?

git version-control xcode xcode5

157
推荐指数
4
解决办法
4万
查看次数

Swift语言中属性中的感叹号是什么?

在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)

swift

44
推荐指数
1
解决办法
2万
查看次数

Xcode 6.1中的可用初始化程序

我有一个自定义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以及如何使用和覆盖?

xcode ios swift

18
推荐指数
1
解决办法
5960
查看次数

"找不到`std`的箱子" - 用简单的代码编译错误

我刚刚更新到每晚最新生锈:

> 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)

是在夜间使用编译器错误还是我没有掌握语言中的一些核心思想?

rust

12
推荐指数
1
解决办法
4231
查看次数

如何删除/调整列表中的分隔符?

有没有办法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 替代品是什么?

list swiftui

12
推荐指数
3
解决办法
7712
查看次数

Intellij Idea中的垂直列在任意位置

第120列的Intellij Idea中有一条垂直线.

有没有办法将它移动一些任意列(我更喜欢每行一百个符号)?

intellij-idea

11
推荐指数
1
解决办法
2332
查看次数

界面生成器中的UIView layoutMargins

在iOS8中有一个新属性UIView:layoutMargin

要以编程方式设置视图的边距:

self.view.layoutMargins = UIEdgeInsetsMake(0, 0, 10, 10);
Run Code Online (Sandbox Code Playgroud)

是否可以在Interface Builder中设置边距?

xcode interface-builder

8
推荐指数
1
解决办法
2926
查看次数

Rust中的"跳转到定义"

经过多年现代IDE(Visual Studio,Xcode,JetBrain产品)的编码,我已经习惯了非常宝贵的Jump to definition功能.当您学习新语言的核心功能时,它对于系统库和框架尤为重要.

是否有任何方法可以为Rust提供与任何现代IDE或文本编辑器相同的功能?任何vim,sublime文本插件?

rust

7
推荐指数
1
解决办法
1831
查看次数

iBeacons的UUID在不同的设备上是不同的

我正在开发一个将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在不同设备上有所不同?这是预期的行为吗?如果是,我怎么能选择退出呢?

ios core-bluetooth indoor-positioning-system ibeacon

2
推荐指数
1
解决办法
1176
查看次数