Error compiling with RxSwift - rx-swift

I'm trying to add RxSwift to my project. Added RxSwift and RxCocoa to my Podfile but when I compile I get this error:
Tried in another empty project and it all works fine. Can't find what's causing this.
EDIT:
Seems like it fails to build Rx-Cocoa. No idea why.

Don't use self.text, That's wrong you can access the Base class you are extending through base property.
In this case base property is gonna be UITextField.
extension Reactive where Base: UITextField {
public var textInput: TextInput<Base> {
return TextInput(base: base, text: base.text)
}
}

import Foundation
import RxSwift
import RxCocoa
//code insert here!!

Related

Using THREEJS OrbitControls with ES6 module import

When I'm trying to import OrbitControls from the ThreeJS examples, the following errors appear: Attempted import error: 'OrbitControls' is not exported from 'three' (imported as 'THREE').
Here is an example:
https://codesandbox.io/s/lyz5y4kq0z
There is now a very simple solution using the standard "three" npm package, just :
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
I think you're trying to access OrbitControls from the instance of THRRE like below
const controls = new THREE.OrbitControls();
But you should try to access the Orbitcontrols like following way
const controls = new OrbitControls();
You can't get rid of this error, if you try to initiate it from THREE. Thanks
DEPRECATED, PLEASE CHECK https://stackoverflow.com/a/65619187/7355534
I finally solved my issue with a simple solution: I removed the code example provided by ThreeJS and I replaced it with a fix.
I've published the corrective here (with some doc): https://gist.github.com/bastienrobert/f381d642da9abaaaf271866db9da59a7
If you have any recommandations, be free to comment!

Any way to import individual components instead of entire set?

I don't need all of the components provided in the 'core' library and was hoping to treeshake/selectively choose which components to import. I've tried a few variations and experiments based on other successes but can't seem to get this one to work.
Current:
import { Menu } from '#blueprintjs/core';
Ideal:
import Menu from '#blueprintjs/core/Menu';
You can import specific components like this:
import { Menu } from "#blueprintjs/core/dist/components/menu/menu";
unpkg is helpful for viewing the folder structure of the published package.
Got it to work:
import { Menu } from "#blueprintjs/core/dist/components/menu/menu";
or
import { Toaster } from "#blueprintjs/core/dist/components/toast/toaster";
etc

How to set iAd Delegate to new View Controller

I am developing an application using Xcode 7 and Swift 2. I recently discovered an error in my code. In the debugger log (I think that is what it is called) , it printed this:
[AppDeveloper] ADBannerView: Unhandled error (no delegate or delegate does not implement didFailToReceiveAdWithError:): Error Domain=ADErrorDomain Code=7 "Ad was unloaded from this banner" UserInfo={ADInternalErrorCode=7, NSLocalizedFailureReason=Ad was unloaded from this banner, ADInternalErrorDomain=ADErrorDomain}
I did some research and found out that I needed this code:
iAdBannerView.delegate = self
In my viewDidLoad method. I tried it, and I no longer recieved the error. However, I have two viewControllers. Both contain iAds. In the original view controller, ViewController.swift, the code workds. In the view controller that I later added, AboutViewContoller, I get this error:
Cannot assign a value of type 'AboutViewController' to a value of type 'ADBannerViewDelegate?"
Could someone please show me my error in my code?
Earlier, I had:
class AboutViewController: UIViewController {
I forgot the ADBannerViewDelegate. The correct code is:
class AboutViewController: UIViewController, ADBannerViewDelegate {
Thanks to Charles A. and Daniel Storm for helping out!

iOS - No Known class method for selector 'dataForDay:month:year'

I got this error when I use kal library its inside KalLogic.m
No Known class method for selector 'dataForDay:month:year'
Any suggestion to fix it
Screen shot of problem
First make sure you import NSDate+Convenience library
import NSDate+Convenience.h
Second add "-ObjC" to the additional flags

Adding View controllers as subview in Swift

Am trying to build a simple calculator app using swift. I have created two view controller with the basic and advanced options. Earlier in Obj-C used to do this
[[AViewController alloc] initWithNibName:#"nibName" bundle:nil]
In swift I cannot even import my new view controllers. But still I can declare as var aViewController:AViewController? and use it. But I am stuck at loading nib
I tried with AViewController(nibName: "nibname", bundle: nil), but everything results in compiler error Could not find an overload for __conversion that accepts the supplied arguments
Try this one,
AViewController(nibName: "nibname", bundle: NSBundle.mainBundle())
This works perfect for me.
Declaration : SWIFT (UINib Class Reference)
init(nibName name: String!,
bundle bundleOrNil: NSBundle!) -> UINib
Declaration : SWIFT (UIViewController Class Reference)
init(nibName nibName: String!,
bundle nibBundle: NSBundle!)
The exclamation mark effectively says, “I know that this optional definitely has a value; please use it.” This is known as forced unwrapping of the optional’s value.
This is the reason, we cannot pass "nil" as second parameter i.e bundle
Cheers..!
Looks like nil was the one causing trouble when I replaced it with NSBundle.mainBundle() it worked.

Resources