草庐IT

multiple-interface-implem

全部标签

ios - swift 4 : multiple marker Google Map not display

我正在开发一个具有多个位置/标记的应用。我创建了一个结构letstates=[State(name:"Zoo1",long:2.276537,lat:102.2989),State(name:"Zoo2",long:2.2772141,lat:102.2984333),//theother51stateshere...]尝试循环但标记没有显示forstateinstates{letstate_marker=GMSMarker()state_marker.position=CLLocationCoordinate2D(latitude:state.lat,longitude:state.

swift - 接口(interface)返回任何?但混凝土返回具体的东西

IbelieveIhavesolvedthiswiththankstothecurrent1pointeranswerandgenerics.I'llupdatetheanswerbelowandaddittothat.Thanks!正在尝试创建命令总线我正在努力在Swift中创建命令总线。我现在遇到的问题是我试图使这个东西足够通用以处理不同的命令,但结果在很多情况下我必须返回Any,这意味着我必须一直对所有内容执行代码内检查,我不确定我能做些什么。代码protocolCommand{}structTestCommand:Command{publicletvalue:int=1}pro

swift - 错误 : Multiple commands produce . .. x86_64.swiftmodule

我正在将一个旧应用程序从swift3迁移到swift4,但遇到了这个错误:error:Multiplecommandsproduce'/Users/.../Library/Developer/Xcode/DerivedData/.../Debug-iphonesimulator/CompassV3.swiftmodule/x86_64.swiftmodule':1)Target'CompassV3'(project'VoidNavigator'):Ditto/Users/.../Library/Developer/Xcode/DerivedData/.../Debug-iphonesi

java - 你如何在 Swift 中复制这个 java 接口(interface)?

我知道您很快就会使用协议(protocol),但您不能像使用Java中的接口(interface)那样自行实例化协议(protocol)。这是Java中的示例restartGameButton.setOnClickListener(newGuiClickListener(){@OverridepublicvoidonClick(floatx,floaty){//TODOAuto-generatedmethodstubrestartScene();//IcanputwhatevercodeIwantinhere.//ThisisgreatbecauseIcanembedthisinsid

ios - 使用 swiftvalidator 时类 'AppDelegate' 的重复接口(interface)定义错误和 Property 有先前的声明错误

我正在尝试使用cocoapods框架SwiftValidator在我的swift应用程序中实现uitextfield验证,并且我使用其中一种swiftvalidator委托(delegate)方法出现奇怪的错误我在我的podfile中添加了swift验证器podfile看起来如下platform:ios,'8.0'use_frameworks!pod'FBSDKCoreKit'pod'FBSDKLoginKit'pod'SwiftValidator','2.1.1'我通过声明importSwiftValidator将swiftvalidator导入到我的LoginViewControl

ios - 是否可以从 Interface Builder 设置 MDCCollectionViewCell?

从演示应用程序中,我看到所有项目都从代码中设置了MDCCollectionViewCell,并且没有使用自动布局来约束subview,这是现在唯一的方法吗? 最佳答案 是的,可以在MDCCollectionView中以正常方式使用Storyboard中创建的自定义单元格.我刚刚修改了Collections>StoryboardExample使用关联Storyboard中定义的自定义单元格。该单元格具有带有斜体文本和浅蓝色背景的自定义标签。它不漂亮,但它传达了这个想法。:)这是否回答了您的问题?

ios - 为什么在 Interface Builder Xcode7.1 OS X Yosemite 中 UICollectionViewCell 的导出为 nil?

我在InterfaceBuilder中创建了一个自定义的UICollectionViewCell,当我运行项目时,UICollectionViewCell的subview为nil,subview不显示。我在网上查了一下,有人说“**我在打电话self.collectionView.registerClass(YNAskQuestionTextCollectionViewCell.self,forCellWithReuseIdentifier:"Cell_Ask_Qustion_text").如果您使用的是Storyboard,则不要调用它。它将覆盖您在Storyboard中的内容。**

swift - 针对不同接口(interface)实现的共享 XCTest 单元测试

我有一些接口(interface)(协议(protocol))的两个或多个实现:protocolInterface{funcmethodOne()funcmethodTwo()}我想测试每个实现,我不想重复代码。我有几个选择,但没有一个能让我满意。第一个是为ImplementationA创建测试用例并将其子类化以获得ImplementationB的测试用例:classImplementationATests:XCTestCase{varimplToTest:Interface!overridefuncsetUp(){super.setUp()implToTest=Implementat

swift - iOS : A specific function can be called from multiple threads/places, 但我希望每次调用都在队列中执行

我有一个函数readData从HealthKit读取数据,需要几秒钟才能执行。可以从多个线程/位置调用此函数,但我希望每次调用都在一个队列中执行,一次一个,而不是并行执行。有没有一种简单的方法可以使用GCD或OperationQueues在SwiftforiOS中实现这一点? 最佳答案 是的,串行DispatchQueue应该可以解决您的问题。确保您在需要访问它的每个函数都可以访问它的范围内创建它。letserialQueue=DispatchQueue(label:"serialQueue")serialQueue.async{/

ios - Interface Builder 文件中的未知类 XXXXX

我写了两个swift文件。//ViewController.swiftimportUIKitclassViewController:UIViewController{overridefuncviewDidLoad(){super.viewDidLoad()}overridefuncdidReceiveMemoryWarning(){super.didReceiveMemoryWarning()}}和//ViewController2.swiftimportUIKitclassViewController2:UIViewController{overridefuncviewDidLoad