Follow the code below for adding pull to refresh to a tableview
value | |
---|---|
iOS version | 11.2 |
Swift | 4 |
/** | |
provide an array of audio files urls and get them merged | |
Its important to note that the process is asynchronous and that one would need to show user some sort of a progress indicator | |
so that the process does not get interupted | |
- parameter audioFileUrls: an array of audio file urls | |
- returns String representing the newly merged file or nil for a failure | |
*/ | |
func mergeAudioFiles(audioFileUrls: [URL]) -> String? { | |
let composition = AVMutableComposition() | |
import UIKit | |
@IBDesignable class CircularImageView: UIImageView { | |
@IBInspectable var lineWidth: CGFloat = 2 | |
@IBInspectable var color: UIColor = UIColor.red | |
override func layoutSubviews() { | |
super.layoutSubviews() | |
@IBDesignable | |
class PlaceHolderTextView: UITextView { | |
@IBInspectable var placeholder: String = "" { | |
didSet{ | |
updatePlaceHolder() | |
} | |
} | |
@IBInspectable var placeholderColor: UIColor = UIColor.gray { |
import React, {Component} from 'react'; | |
import './App.css'; | |
import SideDrawer from "./components/Sidedrawer/side_drawer"; | |
class App extends Component { | |
state = { | |
sideDrawerOpen: false | |
}; | |
drawerToggleClickHandler = () => { |
class JwtTokenAuthMiddleware(BaseMiddleware): | |
""" | |
JWT token authorization middleware for Django Channels 2 | |
""" | |
def get_validated_token(self, raw_token): | |
""" | |
Validates an encoded JSON web token and returns a validated token | |
wrapper object. | |
""" |
Incase you are using djangorestframework-simplejwt
for authentication and Would like to use channels==2.0
.
On web sending token
over headers is not possible if using js WebSocket available API.
To go around this you can send your token on the url as indicated below
wws://example.com?token=[a_valid_token]
The middleware above can be added on routing.py
to supply a valid user to the consumer.
NB :: Securitywise this is not advisable to do.
class Viewcontroller : UIViewController, UITextViewDelegate{ | |
override func viewDidLoad(){ | |
super.viewDidLoad() | |
textView.text = "Placeholder" | |
textView.textColor = UIColor.lightGray | |
} | |
func textViewDidBeginEditing(_ textView: UITextView) { |
<!DOCTYPE> | |
<html lang='en'> | |
<head> | |
<title> Loader example </title> | |
<style> | |
.loading-gif { | |
max-width: 500px; | |
} | |
.pre-loader { |
from django.conf import settings | |
from django.contrib.auth import ( | |
BACKEND_SESSION_KEY, | |
HASH_SESSION_KEY, | |
SESSION_KEY, | |
_get_backends, | |
get_user_model, | |
load_backend, | |
user_logged_in, | |
user_logged_out, |