草庐IT

reference-source

全部标签

ios - swift 数组 : how to append element references in order to update element later on from a synch request?

[更新]我添加了实际的代码片段以使我的问题更清楚。假设我们想将uiimages存储到一个数组中,这些数组是从互联网上获取的。我有这段代码://Somewhereinaloop{varstory=Story()story.imgUrl="http:\(imgUrl)"///Donwloadimage,andreplaceinthetopifletimgUrl=story.imgUrl{ifleturl=NSURL(string:imgUrl){letrequest=NSURLRequest(URL:url)NSURLConnection.sendAsynchronousRequest(r

ios - 在处理关系 Segue 时,iOS 8 的 "Storyboard Reference"的替代方案?

我的应用程序有一个包含4个选项卡的TabBarViewController。其中一个选项卡是“设置”,我想将其移至单独的Storyboard。如果我只考虑iOS9及更高版本作为我的部署目标,那么我可以使用StoryboardReference重构SettingsTab。但是我也想针对iOS8。由于StoryboardReference不支持RelationshipSegue,因此在这种情况下我不能依赖它。所以在包含TabBarViewController的主Storyboard中,我保留了一个虚拟的SettingsTabViewController作为空占位符。在其类文件中的函数"vi

class - swift 类 : reference cycle

当我运行下面的程序时,它会产生段错误。你能帮我弄清楚为什么吗?谢谢classAnimal:NSObject{varname:String!varage:UInt!weakvarspouse:Animal?init(name:String,age:UInt){self.name=nameself.age=age}funcdescription()->String{//tobecomeprintablereturn"name=\(name)andage=\(age)spouse=\(spouse)"}}letdog=Animal(name:"Lucky",age:3)letcat=Anim

Swift : Difference between sources and resources folders in playground file? 为什么 sources 文件夹有 swift 标志?

swiftplayground文件中的Sources和Resources文件夹有什么区别?为什么Sources文件夹上有swift标志?我们可以在每个文件夹中放入什么? 最佳答案 Sources用于支持您希望playground可用的Swift源代码。Resources用于资源文件,如图像、plist等。 关于Swift:Differencebetweensourcesandresourcesfoldersinplaygroundfile?为什么sources文件夹有swift标志?,我

ios - 错误 | [iOS] 文件模式 : The `source_files` pattern did not match any file

我将我的现有库重命名为github,我更改了所有内容并且一切正常,除了它现在不验证我的库-podspeclintKJCircularSlider.podspecfortrunkpush。我检查了我的文件夹结构,它看起来很完美,任何人都可以帮助我实际的问题是什么?如果您想检查文件夹结构,这是我的图书馆-KJCircularSlider这是我的podspec文件。Pod::Spec.newdo|s|s.name='KJCircularSlider's.version='0.1.0's.summary='Circularslider-toslidefrom0to100incircularsh

swift - Codable - arrayPropety [AnyObject] : Reference to member 'data' cannot be resolved without a contextual type

设置Codable类。AnyObjects数组产生编译错误:Referencetomember'data'cannotberesolvedwithoutacontextualtypeclassClassA:NSObject,Codable{//MARK:-Propertieslettitle:Stringletdata:[T]//dataisanarrayofeitherCodableobjectsofClassBorClassC.//MARK:-KeyesprivateenumCodingKeys:String,CodingKey{casetitlecasedata}required

ios - "Ambiguous reference to member map"来自具体类型

这是我的代码。它使用来自CoreBluetooth的CBUUID。让我们假设v的转换是有效的。importUIKitimportCoreBluetoothfuncconvert(v:AnyObject)->[String:String]{return(vas![CBUUID:NSData]).map{(uuid,data)in(uuid.UUIDString,NSString(data:data,encoding:NSUTF8StringEncoding)??"")}}想法是通过为CBUUID调用CBUUID.UUIDString并通过调用适当的NSString构造函数来获取字典的字符

ios - Swift + Storyboard : How to keep strong reference to show segue controller?

我有两个Controller:HistoryViewController,它有一个“浏览”按钮。这嵌入在NavigationController中WebBrowserViewController,将通过HistoryViewController中的浏览按钮访问浏览按钮连接正常。当我点击它时,它会将我带到网络浏览器ViewStoryboard。但是,当我按下返回键并再次点击“浏览”按钮时,它总是会生成一个新的Web浏览器View。因此,如果我在Web浏览器View中的某个页面上返回历史View,然后再次点击“浏览”,我总是会返回主页并丢失当前页面。有没有一种方法可以保持对WebBrows

xcode - iOS8.0 的 CompileSwift 状态为 "the current deployment target does not support automated __weak references"

我正努力在Swift应用程序中使用静态库(从ObjectiveC编译)。我有一个包含相关header的ObjectiveC桥接header。构建应用程序时出现此错误../someDirectory/Xcode/FirstSteps/headers/Acme.h:89:thecurrentdeploymenttargetdoesnotsupportautomated__weakreferencesAcme类确实使用弱引用,但部署目标是iOS8.0,它应该支持它们。我是不是找错树了?Acme.h的第89行显示:-(void)addTopicListener:(__weakNSObject*

ios - Xcode 项目卡住 "Compiling Swift source files"

我的Xcode项目已决定不构建并且简单地卡在“编译Swift源文件”上。我正在使用CocoaPods运行一个完全Swift的项目。我已尝试清除所有派生数据、清理项目并重新启动计算机。我没有运气。我不确定为什么会这样。如果有人有解决此问题的任何想法,将不胜感激。谢谢! 最佳答案 在我的例子中,问题出在一本复杂的字典中。我正在为JSON解析测试创建一个大字典,但编译从未完成。当我将大字典分成小块时,一切正常。 关于ios-Xcode项目卡住"CompilingSwiftsourcefiles